error while publishing the service using arcobjects 10.2.1

1029
5
05-10-2014 04:11 AM
saurabhbanait
New Contributor
error--Instance of service failed to process a request. AutomationException

getting above eror while publishing the service using arcobjects 10.2.1

Any help will be appritiated

i am using following code to publish the the service using arcobjects


            IAGSServerConnectionFactory3 pConnectionFactory = new AGSServerConnectionFactoryClass();

            //admin connection file works fine, tested in ArcCatalog on the same server
            IAGSServerConnection server = pConnectionFactory.OpenFromFile("mxd path", 0) as IAGSServerConnection;

            IAGSServerConnectionAdmin pAGSServerConnectionAdmin = server as IAGSServerConnectionAdmin;
            IServerObjectAdmin pServerObjectAdmin = pAGSServerConnectionAdmin.ServerObjectAdmin;
            IServerObjectConfiguration5 pConfiguration = (IServerObjectConfiguration5)pServerObjectAdmin.CreateConfiguration();
          
           

            //Set the general configuration settings
            pConfiguration.Name = "City_5";
            pConfiguration.TypeName = "MapServer";
          
            pConfiguration.StartupType = esriStartupType.esriSTAutomatic;
            pConfiguration.IsolationLevel = esriServerIsolationLevel.esriServerIsolationHigh;
            pConfiguration.IsPooled = true;
            pConfiguration.Description = "Modsiasdm Map Output";
          
            // pConfiguration.LoadBalancing = esriLoadBalancing.esriLoadBalancingRoundRobin;

            pConfiguration.MinInstances = 1;
            pConfiguration.MaxInstances = 2;
            pConfiguration.WaitTimeout = 60;
            pConfiguration.UsageTimeout = 600;
           
           
            //Set the configuration properties of the MapServer
            IPropertySet pProps = pConfiguration.Properties;
            pProps.SetProperty("FilePath", "C:\\arcgisserver\\arcgisoutput\\newmxd.mxd");
            pProps.SetProperty("OutputDir", "C:\\arcgisserver\\arcgisoutput");
            pProps.SetProperty("MaxImageHeight", "4096");
            pProps.SetProperty("MaxRecordCount", "1000");
            pProps.SetProperty("MaxBufferCount", "1000");
            pProps.SetProperty("MaxImageWidth", "4096");

            pProps.SetProperty("IsCached", false);
            pProps.SetProperty("CacheOnDemand", false);
            pProps.SetProperty("IgnoreCache", false);
            pProps.SetProperty("ClientCachingAllowed", false);
            pConfiguration.Properties = pProps;
           
            //MIME+URL (virtual directory)
            IEnumServerDirectory dirs = pServerObjectAdmin.GetServerDirectories();
            dirs.Reset();
            IServerDirectory serverDir = dirs.Next();
            IGeoProcessor2 gp = new GeoProcessorClass();
            while (serverDir != null)
            {
                if (((IServerDirectory2)serverDir).Type == esriServerDirectoryType.esriSDTypeOutput)
                {
                    pProps.SetProperty("OutputDir", "C:\\arcgisserver\\arcgisoutput");
                    pProps.SetProperty("VirtualOutputDir", "virtual path");
                    break;

                    gp.AddMessage("[DEBUG] Outputpath: " + serverDir.Path + " || Virtual: " + serverDir.URL);
                }
                serverDir = dirs.Next();
            }
          
            //Set the info segment properties
            IPropertySet info = pConfiguration.Info;
            info.SetProperty("WebEnabled", "true");
            info.SetProperty("WebCapabilities", "Map,Query,Data");
            pConfiguration.Info = info;

            //Set the recycle properties of the MapServer object
            IPropertySet recycle = pConfiguration.RecycleProperties;
            recycle.SetProperty("StartTime", "1:00 AM");
            recycle.SetProperty("Interval", "24");
            pConfiguration.RecycleProperties = recycle;

           
            //Add the configuration to the server
           
            pServerObjectAdmin.AddConfiguration(pConfiguration);
           
            pServerObjectAdmin.StartConfiguration("City_5", "MapServer");
0 Kudos
5 Replies
RichardWatson
Frequent Contributor
I think that the example you gave is using DCOM in conjunction with ArcObjects.  I also think that support for that ended with 10.1:

http://resources.arcgis.com/en/help/main/10.2/index.html#//0154000005n9000000

Determine if you have any client applications that connect to ArcGIS Server using DCOM (ArcGIS Server Local) connections
ArcGIS Server versions 10.0 and earlier supported both DCOM (ArcGIS Server Local) and HTTP (ArcGIS Server Internet) connections. Beginning at version 10.1, support for DCOM connections with ArcGIS Server was discontinued. You need to refactor your web applications to use HTTP connections before upgrading. If you used DCOM connections for the purpose of accessing ArcObjects, you need to remove your ArcObjects code or wrap it in a server object extension.
0 Kudos
saurabhbanait
New Contributor
I am not getting what you exactly mean.
can you please explain this with example.
Actually i am new to Arcgis and this is my first assignment.
0 Kudos
saurabhbanait
New Contributor
I think that the example you gave is using DCOM in conjunction with ArcObjects.  I also think that support for that ended with 10.1:

http://resources.arcgis.com/en/help/main/10.2/index.html#//0154000005n9000000

Determine if you have any client applications that connect to ArcGIS Server using DCOM (ArcGIS Server Local) connections
ArcGIS Server versions 10.0 and earlier supported both DCOM (ArcGIS Server Local) and HTTP (ArcGIS Server Internet) connections. Beginning at version 10.1, support for DCOM connections with ArcGIS Server was discontinued. You need to refactor your web applications to use HTTP connections before upgrading. If you used DCOM connections for the purpose of accessing ArcObjects, you need to remove your ArcObjects code or wrap it in a server object extension.


I am new to arcgis so not able to get what exactly you told
0 Kudos
RichardWatson
Frequent Contributor
I do not believe that your code will work because ESRI dropped supported for the APIs that you are using:

http://blogs.esri.com/esri/arcgis/2011/04/27/considerations-for-arcgis-server-developers-a-look-towa...

http://resources.arcgis.com/en/help/arcobjects-cpp/conceptualhelp/index.html#//000100000148000000

At 10.1, you can no longer use ArcObjects remotely (via DCOM); this way of interacting with ArcGIS for Server is no longer supported. If you are using GISServerConnection in the Server library or AGSServerConnection in the GISClient library in your code, these need to be removed if you are working with ArcGIS for Server 10.1.

So what can you do?

I'd suggest to Goggle on "arcgis server create map service programmatically".  Here is a relevant post:

http://gis.stackexchange.com/questions/27873/arcobjects-arcserver-10-1-how-to-programatically-publis...

Read the last post by nicogis who is well informed.
0 Kudos
saurabhbanait
New Contributor
I do not believe that your code will work because ESRI dropped supported for the APIs that you are using:

http://blogs.esri.com/esri/arcgis/2011/04/27/considerations-for-arcgis-server-developers-a-look-towa...

http://resources.arcgis.com/en/help/arcobjects-cpp/conceptualhelp/index.html#//000100000148000000

At 10.1, you can no longer use ArcObjects remotely (via DCOM); this way of interacting with ArcGIS for Server is no longer supported. If you are using GISServerConnection in the Server library or AGSServerConnection in the GISClient library in your code, these need to be removed if you are working with ArcGIS for Server 10.1.

So what can you do?

I'd suggest to Goggle on "arcgis server create map service programmatically".  Here is a relevant post:

http://gis.stackexchange.com/questions/27873/arcobjects-arcserver-10-1-how-to-programatically-publis...

Read the last post by nicogis who is well informed.



Even after using it with soe i ahve the same error. any thing extra i need to use in soe code.
Please help me i am dying here and scraching my head but no clue.
0 Kudos