Esempio n. 1
0
        public void DeleteService(string sArcGisServer,
                                  string sConfigID,
                                  string sFeatureDataset,
                                  string sServiceName,
                                  string sMxdOutput,
                                  string sSDEConnection)
        {
            // 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);
            }

            // Stop and Unpublish
            ServicePublisher.MXD.MapService mapService = null;
            mapService = new MXD.MapService();
            mapService.Stop(sArcGisServer, sServiceName, true);

            // 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);
        }
Esempio n. 2
0
    public void DeleteService(string sArcGisServer,
                                string sConfigID,
                                string sFeatureDataset,
                                string sServiceName,
                                string sMxdOutput,
                                string sSDEConnection)
    {
      // 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);
      }

      // Stop and Unpublish
      ServicePublisher.MXD.MapService mapService = null;
      mapService = new MXD.MapService();
      mapService.Stop(sArcGisServer, sServiceName, true);

      // 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);

    }
Esempio n. 3
0
        public string PublishMap(string sServiceName,
                                 string sServer,
                                 string sMxd,
                                 bool bSde,
                                 int minInstances,
                                 int maxInstances,
                                 int waitTimeout,
                                 int usageTimeout,
                                 int idleTimeout)
        {
            if (sServer != null)
            {
                _ArcGISServer = sServer;
            }

            if (sMxd != null)
            {
                _sNewDocument = sMxd;
            }

            if (sServiceName != null)
            {
                _sTable = sServiceName;
            }

            try
            {
                MapService service = new MapService();

                // Check if MapService already exists
                if (service.Exists(_ArcGISServer, _sTable))
                {
                    return("Service " + _sTable + " already exists.");
                }

                service.Create(_ArcGISServer,
                               _sTable,
                               _sNewDocument,
                               true,
                               true,
                               "C:\\arcgisserver\\arcgisoutput",
                               "http://" + _ArcGISServer + "/arcgisoutput",
                               minInstances,
                               maxInstances,
                               waitTimeout,
                               usageTimeout,
                               idleTimeout,
                               bSde);

                service.Start(_ArcGISServer, _sTable);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return("http://" + _ArcGISServer + "/arcgis/rest/services/" + _sTable + "/FeatureServer");
        }
Esempio n. 4
0
        public bool UnPublishMap(string sServiceName, string sServer, string sPathToMxd, string sServiceFolder, string sOverLayGDB)
        {
            if (sServer != null)
            {
                _ArcGISServer = sServer;
            }

            if (sPathToMxd != null)
            {
                _sNewDocument = sPathToMxd + "\\" + sServiceName + ".mxd";
            }

            if (sServiceName != null)
            {
                _sTable = sServiceName;
            }

            if (sServiceFolder != null)
            {
                _sTable = sServiceFolder + "/" + _sTable;
            }

            try
            {
                MapService service = new MapService();

                // Check if MapService already exists
                if (service.Exists(_ArcGISServer, _sTable))
                {
                    // Stop and Delete MapService
                    service.Stop(_ArcGISServer, _sTable, true);
                }

                // Check if service got removed
                if (service.Exists(_ArcGISServer, _sTable))
                {
                    return(false);
                }

                // Delete MXD
                DeleteMxd(sPathToMxd, sServiceName);

                // Check if MXD was deleted
                if (File.Exists(sPathToMxd + "\\" + sServiceName + ".mxd"))
                {
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        public bool UnPublishMap(string sServiceName, string sServer, string sPathToMxd, string sServiceFolder, string sOverLayGDB)
        {
            if (sServer != null)
                _ArcGISServer = sServer;

            if (sPathToMxd != null)
                _sNewDocument = sPathToMxd + "\\" + sServiceName + ".mxd";

            if (sServiceName != null)
                _sTable = sServiceName;

            if (sServiceFolder != null)
            {
                _sTable = sServiceFolder + "/" + _sTable;
            }

            try
            {
                MapService service = new MapService();

                // Check if MapService already exists
                if (service.Exists(_ArcGISServer, _sTable))
                {
                    // Stop and Delete MapService
                    service.Stop(_ArcGISServer, _sTable, true);
                }

                // Check if service got removed
                if (service.Exists(_ArcGISServer, _sTable))
                {
                    return false;
                }

                // Delete MXD
                DeleteMxd(sPathToMxd, sServiceName);

                // Check if MXD was deleted
                if (File.Exists(sPathToMxd + "\\" + sServiceName + ".mxd")) return false;

                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 6
0
        public string PublishMap(string sServiceName,
                                 string sServer,
                                 string sMxd,
                                 bool bSde,
                                 int minInstances,
                                 int maxInstances,
                                 int waitTimeout,
                                 int usageTimeout,
                                 int idleTimeout)
        {
            if (sServer != null)
                _ArcGISServer = sServer;

            if (sMxd != null)
                _sNewDocument = sMxd;

            if (sServiceName != null)
                _sTable = sServiceName;

            try
            {
                MapService service = new MapService();

                // Check if MapService already exists
                if (service.Exists(_ArcGISServer, _sTable))
                {
                    return "Service " + _sTable + " already exists.";
                }

                service.Create(_ArcGISServer,
                                _sTable,
                                _sNewDocument,
                                true,
                                true,
                                "C:\\arcgisserver\\arcgisoutput",
                                "http://" + _ArcGISServer + "/arcgisoutput",
                                minInstances,
                                maxInstances,
                                waitTimeout,
                                usageTimeout,
                                idleTimeout,
                                bSde);

                service.Start(_ArcGISServer, _sTable);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return "http://" + _ArcGISServer + "/arcgis/rest/services/" + _sTable + "/FeatureServer";
        }