Esempio n. 1
0
        public void DeleteService(string sArcGisServer,
                                  string sAgsInstance,
                                  string sConfigID,
                                  string sFeatureDataset,
                                  string sServiceName,
                                  string sMxdOutput,
                                  string sSDEConnection,
                                  string sAgsUser,
                                  string sAgsPwd,
                                  string sPythonScriptDir)
        {
            // Check if service name starts with http://
            if (sServiceName.IndexOf("http://") > 1)
            {
                throw new ApplicationException("Service name did not begin with the expected http://! ServiceName: " + sServiceName);
            }

            // Parse out service name
            if (sServiceName.Contains("/"))
            {
                sServiceName = sServiceName.Substring(0, (sServiceName.LastIndexOf("/")));
                sServiceName = sServiceName.Substring(sServiceName.LastIndexOf("/") + 1);
            }

            // Set AgsURL
            string sAgsUrl = "http://" + sArcGisServer + ":6080/" + sAgsInstance;

            // Stop and Unpublish
            ServicePublisher.MXD.MapService10_1 mapService = null;
            mapService = new MXD.MapService10_1();
            mapService.UnPublish(sArcGisServer, sAgsUrl, sServiceName, "", sAgsUser, sAgsPwd, System.IO.Path.Combine(sPythonScriptDir, UNPUBLISHSVC_PY));

            // Make sure MXD is deleted
            ServicePublisher.MXD.MxdManager mxdManager = null;
            mxdManager = new MXD.MxdManager();
            mxdManager.DeleteMxd(sMxdOutput, sServiceName);

            // Delete the DataSet from the connection as well
            mxdManager.DeleteFeatureDataset(sFeatureDataset, sSDEConnection, System.IO.Path.Combine(sPythonScriptDir, REMOVEDATA_PY));
        }
Esempio n. 2
0
    public void DeleteService(string sArcGisServer,
                                string sAgsInstance,
                                string sConfigID,
                                string sFeatureDataset,
                                string sServiceName,
                                string sMxdOutput,
                                string sSDEConnection,
                                string sAgsUser,
                                string sAgsPwd,
                                string sPythonScriptDir)
    {
      // Check if service name starts with http://
      if (sServiceName.IndexOf("http://") > 1)
      {
        throw new ApplicationException("Service name did not begin with the expected http://! ServiceName: " + sServiceName);
      }

      // Parse out service name
      if (sServiceName.Contains("/"))
      {
        sServiceName = sServiceName.Substring(0, (sServiceName.LastIndexOf("/")));
        sServiceName = sServiceName.Substring(sServiceName.LastIndexOf("/") + 1);
      }

        // Set AgsURL
        string sAgsUrl = "http://" + sArcGisServer + ":6080/" + sAgsInstance;
      // Stop and Unpublish
      ServicePublisher.MXD.MapService10_1 mapService = null;
      mapService = new MXD.MapService10_1();
      mapService.UnPublish(sArcGisServer, sAgsUrl, sServiceName, "", sAgsUser, sAgsPwd, System.IO.Path.Combine(sPythonScriptDir, UNPUBLISHSVC_PY));

      // Make sure MXD is deleted
      ServicePublisher.MXD.MxdManager mxdManager = null;
      mxdManager = new MXD.MxdManager();
      mxdManager.DeleteMxd(sMxdOutput, sServiceName);

      // Delete the DataSet from the connection as well
      mxdManager.DeleteFeatureDataset(sFeatureDataset, sSDEConnection, System.IO.Path.Combine(sPythonScriptDir, REMOVEDATA_PY));

    }