Skip to content
gdbgeek edited this page May 17, 2013 · 2 revisions

Ever arrived at the office to find your map services have gone to "sleep" overnight and the first time a client application hits the service they get a 400 error like this;

{"error":{"code":400,"message":"","details":["Service 'X' of type 'MapServer' does not exist or is inaccessible."]}}

MapServerKeepAlive is a small .Net console application which "pings" map services via their REST end point. It now also supports an exportmap option which exports a 500x500 pixel PNG around an X/Y co-ordinate. This can be used to further ensure your map services stay up.

At a minimum it takes only three parameters;

-server = the URL to the server REST service end point (eg http://servername/ArcGIS/rest/services) -retry = the number of times to retry if the ping fails -exportmap = after pinging the map service the application will attempt to perform an exportmap for 1000 'units' around an x/y co-ordinate (eg -exportmap 1758316;5926415). This is optional.

You can also access GIS tier secured service by supplying;

-tokenurl http://mercator:6080/arcgis/tokens/ -user agsadmin -password secret1

If your services are secured using Web tier authentication then supply;

-domain GIS -user agsadmin -password secret1

The application enumerates the map services in the root folder as well as iterating each sub-folder. The sub-older interation is one level down only so as an example Root\Folder1\Folder2 services in Folder2 will not be pinged.

An example;

MapServerKeepAlive -server http://maps.aucklandcouncil.govt.nz/ArcGIS/rest/services -retry 5 or MapServerKeepAlive -server http://maps.aucklandcouncil.govt.nz/ArcGIS/rest/services -retry 5 -exportmap 1758316;5926415

Clone this wiki locally