Hello,
I'm trying to Upload a versioned FeatureClass to my ArcGIS-Server from a mobile Device using ArcObjects.
There are up to 50 users doing this in parallel. The Upload works, but only in sequential way. The service is configured right (I'm using a wcf-service) but inside the arcobjects-code it seems that something is waiting till the workspace is a ready or something.
Here is my code:
public String insertFeature(String tableName, String[] fieldValues, String[] fields, Double x, Double y, Logger logger)
{
DateTime t1970 = new DateTime(1970, 1, 1, 0, 0, 0, 0);
Boolean isLicenseStatusGood = this.IsLicenseStatusGood(logger);
if (isLicenseStatusGood)
{
IFeatureCursor cursor = null;
try
{
// Creates a connection to the database
VersionedArcSdeWorkspace("gisora-vm01", "sde:oracle11g", "webline_sachsen_stamm", "webline_sachsen_stamm@agsdb", "agsdb", "SDE.DEFAULT",logger);
IDataset ds;
// Initializing a versioned workspace
IVersionedWorkspace versionedWorkspace = (IVersionedWorkspace)workspace;
IFeatureWorkspace iws = (IFeatureWorkspace)versionedWorkspace;
dsenum = workspace.get_Datasets(esriDatasetType.esriDTFeatureClass);
ds = dsenum.Next();
IFeatureClass featureC= null;
while (ds != null)
{
if (ds.Name.Equals(tableName))
{
featureC= iws.OpenFeatureClass(ds.Name);
}
ds = dsenum.Next();
}
if (featureC!= null)
{
IPoint point = new Point();
point.PutCoords(x, y);
// Creating a workspaceEdit an a MultiuserWorkspaceEdit
IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)versionedWorkspace;
IMultiuserWorkspaceEdit mWorkspaceEdit = (IMultiuserWorkspaceEdit)workspaceEdit;
if (mWorkspaceEdit.SupportsMultiuserEditSessionMode(esriMultiuserEditSessionMode.esriMESMVersioned))
{
// Starting the edit session. (leaving out anything of the next three lines i get the error
// " the requested operation is invalid on a closed state"
mWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
workspaceEdit.StartEditing(false);
workspaceEdit.StartEditOperation();
// Create a new Feature
IFeature feature = table.CreateFeature();
feature.Shape = point;
// Mostly i get errors here
feature.Store();
// or here
workspaceEdit.StopEditing(true);
}
}
}
catch (Exception e)
{
// When i get an error i recall the method until its done without errors
insertFeature(tableName, fieldValues, fields, x, y, logger);
return "500";
}
}
else
{
return "500";
}
return "200";
}
Has anyone an idea?