In this topic
- Adding and removing services
- Starting and stopping services
- Saving service definitions stored by the ArcIMS Application Server
The Service.AddService() method adds a service to an ArcIMS server. It requires the instantiation of a ServiceParameters instance to store service-specific information. ServiceParameters defines the following properties:
- CleanUpInterval—Defines the number of minutes before the ArcIMS Tasker removes images generated by the ArcIMS Spatial Server.
- Directory—The ArcIMS Spatial Server needs to know where to create map or legend images for clients of ArcIMS image services. The location is not validated by the Service class.
- ImageFormat—The Application Developer Framework (ADF) maintains a standard set of image types as static properties on the ESRI.ArcGIS.ADF.Web.ImageFormat class.
- MapFile—The location of the map configuration file (axl). The path must be valid from the ArcIMS API and the ArcIMS Application Server.
- Name—Name of the service.
- PixelLimit—Defines the maximum image size (expressed in number of pixels) possible when generating an output image from an image service.
- VirtualDirectory—An ArcXML response containing the location of an image for an ArcIMS image service including a uniform resource locator (URL) to the image. The URL is not validated by the Service class; however, it must be valid from the client perspective to view the output images generated by the ArcIMS Spatial Server.
- VirtualServer—The name of the virtual server used to expose the service. The virtual server name cannot be discovered programmatically.
These properties are shown in the following code:
A service must be started after it is added.
ServiceParameters sparams = new ServiceParameters();
sparams.CleanUpInterval = 10;
sparams.Directory = "c:\\arcims\\output";
sparams.ImageFormat = ESRI.ArcGIS.ADF.Web.ImageFormat.JPG;
sparams.MapFile = "\\\\myservername\\myshare\\ArcIMS\\Axl\\myservice.axl";
sparams.Name = "myservice";
sparams.PixelLimit = 2000000;
sparams.VirtualDirectory = "http://mywebserver/output";
sparams.VirtualServer = "ImageServer1";
Service.AddService("myserver", 5300, sparams, "admin_user", "admin_password");
The Service.RemoveService() method removes an existing service from an ArcIMS server as shown in the following code:
[C#]
Service.RemoveService("myserver", 5300, "myservice", "admin_user", "admin_password");
The Service.StartService() method starts an existing service on an ArcIMS server as shown in the following code:
[C#]
Service.StartService("myserver", 5300, "myservice", "admin_user", "admin_password");
The Service.StopService() method stops an existing service on an ArcIMS server as shown in the following code:
[C#]
Service.StopService("myserver", 5300, "myservice", "admin_user", "admin_password");
Any changes to services associated with an ArcIMS server persist as long as the ArcIMS Application Server is running. To persist changes, after the ArcIMS Application Server is restarted, the state of the Application Server must be saved. When the Service.Save() method is called, the current state of the ArcIMS Application Server is saved in the ArcIMSSite.sez file on the ArcIMS Application Server machine. This process is shown in the following code:
[C#]
Service.Save("myserver", 5300, "admin_user", "admin_password");