niry-systematics-co-il-esridist

Failing to create a localfeatureservice for editing

Discussion created by niry-systematics-co-il-esridist on Jun 5, 2012
Latest reply on Jun 20, 2012 by MBranscomb-esristaff
Hello,

I get the following exception :
"Failed to create a 'LocalFeatureService' for editing as the service with the same path is already running as an instance of 'LocalMapService' which does not support editing".

It happens in several occasions.
For instance, when I'm instatiating a new editable feature layer after using a QueryTask
or, as shown below, when instatiating a new editable feature layer after instantiating a non-editable layer.


ArcGISLocalFeatureLayer ReadOnlyFeatureLayer = new ArcGISLocalFeatureLayer(@"C:\Data\Map.mpk", 0);
ReadOnlyFeatureLayer.ID = "Streets";
ReadOnlyFeatureLayer.Editable = false;
_mapControl.Layers.Add(ReadOnlyFeatureLayer);

ArcGISLocalFeatureLayer EditableFeatureLayer = new ArcGISLocalFeatureLayer(@"C:\Data\Map.mpk", 1);
EditableFeatureLayer .ID = "Trees";
EditableFeatureLayer .Editable = true;
_mapControl.Layers.Add(EditableFeatureLayer );


What am I doing wrong here ? Can't I use editable and not editable layers on the same mpk ?

I would appreciate your help.
Regards,
Nir

Outcomes