saurabhbanait

error while publishing the service using arcobjects 10.2.1

Discussion created by saurabhbanait on May 10, 2014
Latest reply on May 11, 2014 by saurabhbanait
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");

Outcomes