public static void SetFeatureAccessOnMapService(string serverMachineName, string serviceName)
{
IAoInitialize aoInit = new AoInitializeClass();
aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcServer);
IGISServerConnection2 pGISServerConnection = new GISServerConnectionClass();
pGISServerConnection.Connect(serverMachineName);
IServerObjectAdmin pServerObjectAdmin = pGISServerConnection.ServerObjectAdmin;
IServerObjectConfiguration4 pConfiguration4 = (IServerObjectConfiguration4)pServerObjectAdmin.GetConfiguration(serviceName, "MapServer");
pConfiguration4.set_ExtensionEnabled("FeatureServer", true);
IPropertySet info = pConfiguration4.get_ExtensionInfo("FeatureServer");
info.SetProperty("WebEnabled", "true");
info.SetProperty("WebCapabilities", "Query,Editing");
pServerObjectAdmin.UpdateConfiguration(pConfiguration4);
pServerObjectAdmin.StartConfiguration(serviceName, "MapServer");
}