Hello,
I have a need to programmatically restart a map service. I have found Javascript code to successfully clear the services cache (half of the task) but I can't find code that will allow me to restart a map service. We are using ArcGIS 10.0. Does anyone have any thoughts, whether it be a way to do this via Javascript or an ArcGIS command-line tool, or ???
Thanks - Peter
I'm not sure if this would work against 10.0, but you could try using python to script against the server admin api. I've pasted a link to one of the samples below. Shouldn't take long to try it and see what happens.
Freddie - Thanks for the reply. Yes, I had run across that help document and tried it but for whatever reason, there is no URL that will utilize a START / STOP call. Maybe it is something new in 10.1 or maybe we are missing some configuration in our 10.0, but that solution won't help right now. Thanks - Peter
Hi Peter,
Below is the class link to start/stop arcgis server services through arcobject . It may be helpful for you.
ArcObjects Help for .NET developers
Thanks
Mudit
Peter:
How long will you still be at version 10? I ask because the ability to start a mapservice programmatically is much easier at v10.1 and forward using python based AGS admin tools.
Michael - Thanks for the reply. While there has been talk of moving to 10.2, it will be a glacial process so unfortunately, I must try to find a 10.0 solution.
If you have to stay at v10.0 then you can use AGSSOM.exe that should be located at either (This assumes you are running the bat file on the same machine where AGS is installed:
c:\Program Files (x86)\AGSSOM\ (I believe it would most likely be here since AGS v10.0 was 32 bit I believe), if it is run from a Windows Server machine (I am using Windows Server 2008 R2)
or
c:\Program Files\AGSSOM\.
I run at bat file through a Windows Scheduled Task and the bat file is quite simple:
echo %time% > Start_AGS_Services.txt
"c:\Program Files (x86)\AGSSOM\AGSSOM.exe" -s "AGS Virtual Directory"/"Mapservice name" >> Start_AGS_Services.txt
I have a txt file in the same directory as where the bat file is located so I get some limited logging for this simple process.
Michael - It looks like that AGSSOM.exe is not installed by arcGIS by default. I have no such file on the OS where the ArcGIS Server was installed. I did find the page http://www.arcgis.com/home/item.html?id=b06bf5c446af401e9203f89993318040 which indicated that it is a downloadable utility. so it looks like it probably would help us if I could download it and add it to the designated server. That may be a problem for us but I will see. Thanks for the heads up on it - Peter
I did not realize that I had to download that utility as I had done that 3 or 4 years ago. The newer python AGS admin utility scripts have made this utility obsolete in the AGS v10.1 and newer versions so I don't use AGSSOM.exe anymore.
Michael - Good news. The AGSSOM downloaded as a ZIP file. Within the ZIP file were versions for 9.3.1, 10.0, and 10.1. Each version contained the source code (a single C# source code file). I was then able to write my own Java ArcObjects version for the part I was interested in and all seems to run fine. Thanks - Peter