Workspace or data source is read only on create a new row

09-15-2020 04:13 PM
by Anonymous User
Not applicable

when i try to create a new row in a many to many relational class using this code

ITable DuctsToCablesTable = (ITable)this.mapServerDataAccess.GetDataSource(this.mapServerInfo.Name, this.DuctsToCablesId);
IDataset mapdataset = (IDataset)DuctsToCablesTable;
IWorkspace esmap = mapdataset.Workspace;
IWorkspaceEdit eswditemap = (IWorkspaceEdit)esmap;
IRow row = DuctsToCablesTable.CreateRow();

This error appears to me

Message=Workspace or data source is read only.
Source=<Cannot evaluate the exception source>
<Cannot evaluate the exception stack trace>

any one can please help me ?

0 Kudos
1 Reply
Esri Contributor

If you want to edit the map service's data source using IMapServerDataAccess.GetDataSource, your map service's data source needs to be in a registered enterprise geodatabase (you don't have to check the Feature Access capability though).

If your map service's data source is from a file geodatabase, registered folder, or copied to server, then the service's data is not editable via SOE/SOI, because the service itself in this case is read-only and not editable, and so is the service's data source/workspace.

However, you can edit data (such as a file gdb feature class) in SOE/SOI via direct access to the data through WorkspaceFactory (such as IWorkspaceFactory.OpenFromFile), instead of the service access (IMapServerDataAccess.GetDataSource). In this scenario, your arcgis server account must have permission to access the data (such as the .gdb), in other words, the data must be at a location where server account has permission to access.

0 Kudos