Hi, I need to copy Map service which is created in ArcGIS server 10.1 (sp1), to another ArcGIS server (10.1 sp1) machine. I am trying to do this process manually by copying service file from C:\arcgisserver\config-store\services and C:\arcgisserver\directories\arcgiscache and *.JSON files. Service can read by new machine but cannot start the service. So please give a direction that how can i do this work.
In our case we had to copy from\arcgisserver\config-store\services\arcgisserver\directories\arcgiscache\arcgisserver\directories\arcgisoutput\arcgisserver\directories\arcgissystem\arcgisinput
ERROR: Service failed to start, Machine: myServer.COM [null]
Also we developped some tool to do that in a more automatic way :
GitHub - eea/discomap.ServiceTransferTool: Transfer tool
Others tools
European Environment Agency · GitHub
Sebastien,
Will your transfer tool work with two different versions of server? I would like to move services on 10.1 to a new 10.3.1 server.
Yes.
We did several test (not these exact versions) and it was working
Edit #2: I got it to work. See my summary information at the end.
Hi Sebastien,
This thread is about 8 months old now, but thought I would see if you monitor it at all. I downloaded the ServiceTransferTool from github and was trying to see if I could go from an AGS 10.2.2 machine to AGS 10.4.1....but have tried running both in Desktop 10.4.1 (on server) and my local Desktop 10.3.1. I had to comment out the import of pymssql and the writeinDatabase function, but that looked like it was something more internal to eea, so I don't think that matters.
However, I am getting an error
My arcgisserver service directories are on the D drive, so it seems to be getting that info, but it should probably b "d:\\" ...not error is not showing the ":". I've been trying to work backwards to see where this is being pulled from, but haven't found it yet. Although I have a utility that looks at the config.json file for this info, so maybe this is doing the same (and I just haven't found that yet).
The attributes I am entering:
my input includes:
<sourceServer> 6080 <admin> <adminpass> MapServer <checked services, public ones> <targetServer> 6080 <admin> <adminpass> <blank> \\<targetServer>\<shareToD>\<newfoldername1> OverwriteIsChecked \\<targetServer>\<shareToD>\<newfoldername2>
for the systemTemp and backupTemp I am putting in "\\<targetserver>\<shareToD>\<foldername>" ..I was putting this as the target server.....it is support to be the source?
Questions:
....I notice that my mxd is not in the root of the service, but in a subfolder \extracted\v101 ..maybe that is a remanent from the 10.1->10.2.x migration ??
For what it is doing, I do not think the error has anything to do with 10.4.x
If you have any insight I would appreciate it. It looks like a useful tool if I can get it to work for our site.
Thanks for any help.
*******************************
Edit: getting closer. I had to change a few lines to have it take my server name in the path to the services .mxd location...still need to work on that to make it more automatic, but it does find the mxd now. If running on a 10.3.1 again the target 10.4.1, it would crash I'm assuming because it doesn't like the versions being different. So running in Desktop 10.4.1 on the target server...with about 5 patches, including the publishing patch.....I can get to Step 4 but the service will not publish (although it thinks it was successful, per a message. I need to go investigate this next.
This is the new error I am getting:
SUMMARY (Resolved)
Wanted to give a summary of what I did to get this to work. I tested on a 10.4.1 AGS server, pulling from a 10.2.1 AGS server.
After all that, my 4 "public" test services (have not tested secure services yet) worked.
Only other issue, which is an internal things, as I was getting ssl certificate errors/warnings. I just closed the popup and it continued. This is a self-signed cert, with "10dot" addresses...that is, something that network services has for our internal servers. I've given up on trying to have them get rid of the error, since things work for my test environment (just annoying).
Hope this helps someone down the line. My procedures my not work specifically but may help with debugging. Have fun.
Rebecca Strauch, Emily Keefer-Cowles
Hello Rebecca, I am happy to note that you actually got this tool to work at your end. I am currently trying to use the tool to copy some bunch of map services from my existing ArcGIS Server 10.4 to a new ArcGIS Server 10.4 but I keep getting this error
Directory not copied. Error: [Error 3] The system cannot find the path specified: u'E\\arcgisserver\\directories\\arcgissystem\\arcgisinput\\NaturalResources\\MS4_Map_SupportingLayers_Public_Viewer_Natural_Resources.MapServer\\*.*'Service MXD not found.
Directory not copied. Error: [Error 3] The system cannot find the path specified: u'E\\arcgisserver\\directories\\arcgissystem\\arcgisinput\\NaturalResources\\MS4_Map_SupportingLayers_Public_Viewer_Natural_Resources.MapServer\\*.*'
Service MXD not found.
I don't understand why it is displaying the 'drive E' without the colon. Is this right?.
These are the paths I specified for the system sysTemp field
E:\arcgisserver\directories\arcgissystem\arcgisinput\sysTemp
for the backupTemp
E:\arcgisserver\directories\arcgissystem\arcgisinput\backup
Both 'sysTemp' and 'backup' folders were created in my new ArcGIS 10.4 Server which is the destination server. I didn't fill anything in the 'Destination_Folder' field
I have tried to follow all the steps you stipulated above unfortunately I'm still not able to get it to run successfully. Please can you explain more details of what exactly you did to get the tool to work for you.
I have over 280 map services I need to copy and would really be happy if this tool could work for me. That would make life much easier for me.
thanks
Hi Irene,
I was getting the same error, and I used arcpy.AddMessage or print statements to print out the variables and the approximate line number in my code (to I could find it easily). For my use, I used the V101 folder to grab my .mxd. I've included a snip of the code with my comments. I did several other changes after I resolved this, like read my admin credentials from an ini file vs hardcoding them, so my record numbers in my comments might be off.
...oops, need to open this in another browser tab to post my code... Look at about line 76 below to see my comments
<SPAN class="comment token">#...</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>AddMessage<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"\n ** Service '"</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>service<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> <SPAN class="string token">"' information read successfully. Now transfering... (5 steps)"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Deserialize response into Python object</SPAN> propInitialService <SPAN class="operator token">=</SPAN> json<SPAN class="punctuation token">.</SPAN>loads<SPAN class="punctuation token">(</SPAN>data<SPAN class="punctuation token">)</SPAN> user <SPAN class="operator token">=</SPAN> getpass<SPAN class="punctuation token">.</SPAN>getuser<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> pathInitial <SPAN class="operator token">=</SPAN> propInitialService<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"properties"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">"filePath"</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="comment token">#arcpy.AddMessage("pathInitial line 653: {0}".format(pathInitial))</SPAN> pathInitial <SPAN class="operator token">=</SPAN> pathInitial<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN><SPAN class="string token">':'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'$'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># this is stripping the ":" from d:\ with $</SPAN> <SPAN class="comment token">#arcpy.AddMessage("pathInitial line 655: {0}".format(pathInitial))</SPAN> pathInitial <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"\\\\{0}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>fromServerName<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> pathInitial<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># add source server name to path</SPAN> <SPAN class="comment token">#arcpy.AddMessage("pathInitial line 657: {0}".format(pathInitial)) </SPAN> msdPath <SPAN class="operator token">=</SPAN> pathInitial<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'X'</SPAN><SPAN class="punctuation token">,</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">'\\'</SPAN> <SPAN class="operator token">+</SPAN> fromServerName<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'x'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#arcpy.AddMessage("msdPath line 659: {0}".format(msdPath))</SPAN> <SPAN class="keyword token">if</SPAN> newFolder <SPAN class="operator token">!=</SPAN> <SPAN class="string token">""</SPAN> <SPAN class="punctuation token">:</SPAN> folderName <SPAN class="operator token">=</SPAN> newFolder <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> folderName <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>split<SPAN class="punctuation token">(</SPAN>service<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN> serviceName <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>split<SPAN class="punctuation token">(</SPAN>service<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> serviceName2 <SPAN class="operator token">=</SPAN> serviceName pos3 <SPAN class="operator token">=</SPAN> serviceName2<SPAN class="punctuation token">.</SPAN>find<SPAN class="punctuation token">(</SPAN><SPAN class="string token">".MapServer"</SPAN><SPAN class="punctuation token">)</SPAN> simpleServiceName <SPAN class="operator token">=</SPAN> serviceName2<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">:</SPAN>pos3<SPAN class="punctuation token">]</SPAN> <SPAN class="comment token">#arcpy.AddMessage("simpleServiceName line 668: {0}".format(simpleServiceName))</SPAN> <SPAN class="keyword token">if</SPAN> folderName <SPAN class="operator token">!=</SPAN> <SPAN class="string token">'root'</SPAN> <SPAN class="operator token">or</SPAN> folderName <SPAN class="operator token">!=</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">:</SPAN> finalServiceName <SPAN class="operator token">=</SPAN> folderName <SPAN class="operator token">+</SPAN> <SPAN class="string token">"//"</SPAN> <SPAN class="operator token">+</SPAN> simpleServiceName <SPAN class="operator token">+</SPAN> <SPAN class="string token">".MapServer"</SPAN> temp_workspace <SPAN class="operator token">=</SPAN> string<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN>workspace<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">':'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> temp_workspace <SPAN class="operator token">=</SPAN> string<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN>temp_workspace<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'X'</SPAN><SPAN class="punctuation token">,</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">'\\'</SPAN> <SPAN class="operator token">+</SPAN> socket<SPAN class="punctuation token">.</SPAN>gethostname<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'x'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> sources <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>temp_workspace<SPAN class="punctuation token">,</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>folderName<SPAN class="punctuation token">,</SPAN> simpleServiceName <SPAN class="operator token">+</SPAN> <SPAN class="string token">".MapServer"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> finalServiceName <SPAN class="operator token">=</SPAN> serviceName temp_workspace <SPAN class="operator token">=</SPAN> string<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN>workspace<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">':'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> sources <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>string<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN>temp_workspace<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'X'</SPAN><SPAN class="punctuation token">,</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">'\\'</SPAN> <SPAN class="operator token">+</SPAN> socket<SPAN class="punctuation token">.</SPAN>gethostname<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'x'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> serviceName<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#Check if the service exists</SPAN> <SPAN class="comment token">#arcpy.AddMessage("finalServiceName line 672: {0}".format(finalServiceName))</SPAN> serviceExists <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">False</SPAN> serviceExistsOld <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">False</SPAN> serviceExists <SPAN class="operator token">=</SPAN> isServicePresent<SPAN class="punctuation token">(</SPAN>toServerName<SPAN class="punctuation token">,</SPAN> str<SPAN class="punctuation token">(</SPAN>toServerPort<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> targetServerToken<SPAN class="punctuation token">,</SPAN> simpleServiceName<SPAN class="punctuation token">,</SPAN> folderName<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN> pos <SPAN class="operator token">=</SPAN> msdPath<SPAN class="punctuation token">.</SPAN>find<SPAN class="punctuation token">(</SPAN>serviceName<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> len<SPAN class="punctuation token">(</SPAN>serviceName<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#arcpy.AddMessage("pos line 687: {0}".format(pos))</SPAN> inputFolderPath <SPAN class="operator token">=</SPAN> msdPath<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">:</SPAN>pos<SPAN class="punctuation token">]</SPAN> <SPAN class="comment token">#arcpy.AddMessage("inputFolderPath line 691: {0}".format(inputFolderPath))</SPAN> inputFolderPath <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>inputFolderPath<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"extracted"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"v101"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#arcpy.AddMessage("inputFolderPath line 693: {0}".format(inputFolderPath))</SPAN> <SPAN class="comment token">#If service exists and must be overwritten </SPAN> <SPAN class="keyword token">if</SPAN> serviceExists <SPAN class="operator token">==</SPAN> <SPAN class="token boolean">True</SPAN> <SPAN class="operator token">and</SPAN> overwrite <SPAN class="operator token">==</SPAN> <SPAN class="string token">'true'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token">#Backup old service</SPAN> serviceURLforbackup <SPAN class="operator token">=</SPAN> <SPAN class="string token">"/arcgis/admin/services/"</SPAN> <SPAN class="operator token">+</SPAN> folderName <SPAN class="operator token">+</SPAN> <SPAN class="string token">"/"</SPAN> <SPAN class="operator token">+</SPAN> serviceName <SPAN class="comment token">#arcpy.AddMessage("\nserviceURLforbackup line 700: {0}".format(serviceURLforbackup))</SPAN> <SPAN class="comment token"># This request only needs the token and the response formatting parameter</SPAN> tokenforbackup <SPAN class="operator token">=</SPAN> targetServerToken <SPAN class="comment token"># gentoken(toServerName, toServerPort, toAdminUser, toAdminPass)</SPAN> paramsforbackup <SPAN class="operator token">=</SPAN> urllib<SPAN class="punctuation token">.</SPAN>urlencode<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN><SPAN class="string token">'token'</SPAN><SPAN class="punctuation token">:</SPAN> tokenforbackup<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'f'</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'json'</SPAN><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN> responseforbackup<SPAN class="punctuation token">,</SPAN> dataforbackup <SPAN class="operator token">=</SPAN> postToServer<SPAN class="punctuation token">(</SPAN>toServerName<SPAN class="punctuation token">,</SPAN> str<SPAN class="punctuation token">(</SPAN>toServerPort<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> serviceURLforbackup<SPAN class="punctuation token">,</SPAN> paramsforbackup<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#arcpy.AddMessage("\nresponseforbackup line 706: {0}".format(responseforbackup))</SPAN> <SPAN class="comment token">#arcpy.AddMessage("\ndataforbackup line 707: {0}".format(dataforbackup))</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>responseforbackup<SPAN class="punctuation token">.</SPAN>status <SPAN class="operator token">==</SPAN> <SPAN class="number token">200</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">and</SPAN> assertJsonSuccess<SPAN class="punctuation token">(</SPAN>dataforbackup<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> propInitialServiceforbackup <SPAN class="operator token">=</SPAN> json<SPAN class="punctuation token">.</SPAN>loads<SPAN class="punctuation token">(</SPAN>dataforbackup<SPAN class="punctuation token">)</SPAN> pathInitialforbackup <SPAN class="operator token">=</SPAN> propInitialServiceforbackup<SPAN class="punctuation token">[</SPAN><SPAN class="string token">"properties"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">"filePath"</SPAN><SPAN class="punctuation token">]</SPAN> pathInitialforbackup <SPAN class="operator token">=</SPAN> pathInitialforbackup<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN><SPAN class="string token">':'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">''</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> msdPathforbackup <SPAN class="operator token">=</SPAN> pathInitialforbackup<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'X'</SPAN><SPAN class="punctuation token">,</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">'\\'</SPAN> <SPAN class="operator token">+</SPAN> toServerName<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'x'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#arcpy.AddMessage("\n msdPathforbackup line 715: {0}".format(msdPathforbackup))</SPAN> posforbackup <SPAN class="operator token">=</SPAN> msdPathforbackup<SPAN class="punctuation token">.</SPAN>find<SPAN class="punctuation token">(</SPAN>serviceName<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">+</SPAN> len<SPAN class="punctuation token">(</SPAN>serviceName<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># doesn't handle the d$ or share correctly</SPAN> <SPAN class="comment token"># inputFolderPathforbackup = msdPathforbackup[:posforbackup] </SPAN> <SPAN class="comment token"># arcpy.AddMessage("\ninputFolderPathforbackup line 719: {0}".format(inputFolderPathforbackup))</SPAN> <SPAN class="comment token"># so using inputFolderPath which I modified above</SPAN> <SPAN class="comment token">#</SPAN> copyFrom <SPAN class="operator token">=</SPAN> inputFolderPath <SPAN class="comment token">#inputFolderPathforbackup </SPAN> <SPAN class="comment token">#arcpy.AddMessage("\ncopyFrom line 722: {0}".format(copyFrom))</SPAN> <SPAN class="comment token">#</SPAN> copyTo <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>workFolder<SPAN class="punctuation token">,</SPAN> folderName<SPAN class="punctuation token">,</SPAN> serviceName<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#arcpy.AddMessage("copyTo line 724: {0}".format(copyTo))</SPAN> continuePublish1 <SPAN class="operator token">=</SPAN> copy<SPAN class="punctuation token">(</SPAN>copyFrom<SPAN class="punctuation token">,</SPAN> copyTo<SPAN class="punctuation token">)</SPAN> continuePublish2 <SPAN class="operator token">=</SPAN> createZipFile<SPAN class="punctuation token">(</SPAN>copyFrom<SPAN class="punctuation token">,</SPAN> workFolder <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\\"</SPAN> <SPAN class="operator token">+</SPAN> folderName <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\\"</SPAN> <SPAN class="operator token">+</SPAN> serviceName <SPAN class="operator token">+</SPAN> <SPAN class="string token">".zip"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">if</SPAN> continuePublish1 <SPAN class="operator token">==</SPAN> <SPAN class="token boolean">True</SPAN> <SPAN class="operator token">and</SPAN> continuePublish2 <SPAN class="operator token">==</SPAN> <SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">:</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>AddMessage<SPAN class="punctuation token">(</SPAN><SPAN class="string token">" Step 0: Old service backup done succesfully."</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>AddMessage<SPAN class="punctuation token">(</SPAN><SPAN class="string token">" Step 0: Error when backing up old service ."</SPAN><SPAN class="punctuation token">)</SPAN> serviceExistsOld <SPAN class="operator token">=</SPAN> serviceExists serviceExists <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">False</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Remember, the line numbers in the AddMessage statements won't match yours, but I suggest adding a few like this if you still need to trace things back. I left them in my code although, once fixed, I commented them out.
Hope this helps.
Thank you so much Rebecca, I did some modifications following the steps you described above, when I ran the script, it is able to copy over some of the map services and not able to copy some. It reported the error below which i believe could be specific to the individual map service. For these specific map services it is not able to analyze the service definition drafts and I am currently looking into this issue. Did you get similar error in yours?
Service could not be published because errors were found during analysis
Thank you very much
Irene Egbulefu I edited your last response so it didn't include my previous response, quoted, twice. But it doesn't look like your error message got pasted. you may want to try again. oh, never mind...the green was the error message.
I do not have anywhere the number of services you have to move over, but it won't surprise me if all mine do not come over cleanly either. Keep in mind that I made sure my data was copied over to the new server, if needed, and made sure all my data links were also set up exactly the same, that is,same names. My guess is that is there is anything that is "broken" in the source service, it will have issues copying over.
It looks like it's writing the errors to a text file:
... # if the sddraft analysis contained errors else: #Service Definition Draft could not be analyzed if analyseDraft['errors'] == "NO": arcpy.AddWarning(" Service Definition Draft could not be analyzed.") content = "\n " + formatDate() + "\n Service Definition Draft could not be analyzed. \n - " + finalServiceName + "\n" serviceFailureNumber = serviceFailureNumber + 1 writeTxtFile(False, content, serviceFailureNumber, content1, workspace) #writeInDatabase(fromServerName, toServerName, serviceType, finalServiceName, service, user, sources, 'Service Definition Draft could not be analyzed.') else: arcpy.AddWarning(" Service could not be published because errors were found during analysis. ") content = "\n " + formatDate() + "\n Service could not be published because errors were found during analysis. \n " + str(analyseDraft['errors']) + "\n - " + finalServiceName + "\n" serviceFailureNumber = serviceFailureNumber + 1 writeTxtFile(False, content, serviceFailureNumber, content1, workspace)<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
You can add what's stored in the content variable to the AddWarning message:
... # if the sddraft analysis contained errors else: #Service Definition Draft could not be analyzed if analyseDraft['errors'] == "NO": arcpy.AddWarning(" Service Definition Draft could not be analyzed.") content = "\n " + formatDate() + "\n Service Definition Draft could not be analyzed. \n - " + finalServiceName + "\n" serviceFailureNumber = serviceFailureNumber + 1 writeTxtFile(False, content, serviceFailureNumber, content1, workspace) #writeInDatabase(fromServerName, toServerName, serviceType, finalServiceName, service, user, sources, 'Service Definition Draft could not be analyzed.') else: #Include the results of the analysis within the message messageContent = "Service could not be published because errors were found during analysis. \n " + str(analyseDraft['errors']) + "\n - " + finalServiceName + "\n" #Add the message to the tool arcpy.AddWarning(messageContent) content = "\n " + formatDate() + "\n Service could not be published because errors were found during analysis. \n " + str(analyseDraft['errors']) + "\n - " + finalServiceName + "\n" serviceFailureNumber = serviceFailureNumber + 1 writeTxtFile(False, content, serviceFailureNumber, content1, workspace)<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
This way, it prints the message but also writes to the file created by the createTxtFile function, (whatever the "workspace" variable is defined to, which appears to be the sysTemp folder path).
rastrauch
Below are ESRI recommendations for migrating services between two machines (it will work in either same AGS version or different version)
Commented on a different post on this, I'll provide a link here:
https://community.esri.com/thread/188732-the-best-practice-to-transfer-the-arcgis-server-data-from-one-machine-to-another?e…
We are working in package to automate the copy of services between ArcGIS Servers. The package and some scripts are available here GitHub - jbelo-pro/arcser-admin: ArcGis administration
So far this just support Map Services and Geocode Services
Sorry to bring up an older thread but I've been trying to get this script / tool to work as we migrate to three new ArcGIS Server VMs. I made many of the updates you recommended, but am a little stumped as to why this script is still failing on our side. When I run the tool, it fails with the following directories and locations identified. I'm attempting to migrate (in this example just one service) from our old server (southerly) to our new Dev Server (DEQ-GIS-DEV) and it's failing with Service MXD not found error as seen below:
Executing: TransferServices southerly 6080 ***** ***** MapServer public//2018_adb_anyuse.MapServer DEQ-GIS-DEV 6080 ****** ****** # \\DEQ-GIS-DEV\C$\arcgisserver\directories\arcgissystem\arcgisinput\sysTemp # \\DEQ-GIS-DEV\C$\arcgisserver\directories\arcgissystem\arcgisinput\backupStart Time: Tue Sep 17 14:06:17 2019Running script TransferServices...
** Service 'public//2018_adb_anyuse.MapServer' information read successfully. Now transfering... (5 steps)pathInitial line 581: C:\arcgisserver\directories\arcgissystem\arcgisinput\public\2018_adb_anyuse.MapServer\extracted\v101\final_2018_adb_anyuse.msdpathInitial line 657: C\arcgisserver\directories\arcgissystem\arcgisinput\public\2018_adb_anyuse.MapServer\extracted\v101\final_2018_adb_anyuse.msdmsdPath line 659: \\southerly\C\arcgisserver\directories\arcgissystem\arcgisinput\public\2018_adb_anyuse.MapServer\extracted\v101\final_2018_adb_anyuse.msdsimpleServiceName line 668: 2018_adb_anyusefinalServiceName line 672: public//2018_adb_anyuse.MapServerinputFolderPath line 691: \\southerly\C\arcgisserver\directories\arcgissystem\arcgisinput\public\2018_adb_anyuse.MapServerinputFolderPath line 693: \\southerly\C\arcgisserver\directories\arcgissystem\arcgisinput\public\2018_adb_anyuse.MapServer\\DEQ-GIS-DEV\C$\arcgisserver\directories\arcgissystem\arcgisinput\sysTemp\2019917_14617_southerly_DEQ-GIS-DEV\Directory not copied. Error: [Error 67] The network name cannot be found: u'\\\\southerly\\C\\arcgisserver\\directories\\arcgissystem\\arcgisinput\\public\\2018_adb_anyuse.MapServer\\*.*' Service MXD not found.
*************************************************************************** - Number of services in 'southerly': 19 - Number of services selected in 'southerly': 1 - Number of services transfered successfully to 'DEQ-GIS-DEV': 0 - Number of services not transfered to 'DEQ-GIS-DEV': 1
- The migration backup is placed in: \\DEQ-GIS-DEV\C$\arcgisserver\directories\arcgissystem\arcgisinput\sysTemp\2019917_14617_southerly_DEQ-GIS-DEV\*************************************************************************** Completed script TransferServices...Succeeded at Tue Sep 17 14:06:18 2019 (Elapsed Time: 1.76 seconds)
When I check the logs, I see:
*************************************************************************** Publishing in Server: DEQ-GIS-DEV Port: 6080 AdminUser: ***** 2019-09-17 14:06:17 *************************************************************************** 2019-09-17 14:06:18 Service MXD not found. - public//2018_adb_anyuse.MapServer
I don't understand why the script seems be looking at the \\DEQ-GIS-DEV\C$\arcgisserver\directories\arcgissystem\arcgisinput\sysTemp\2019917_14617_southerly_DEQ-GIS-DEV\ directory in the temp for the .mxd... or perhaps why it failed to find and copy it to begin with where the .mxd exists on the origin server at (for this service): C:\arcgisserver\directories\arcgissystem\arcgisinput\public\2018_adb_anyuse.MapServer\extracted\v101\fnal_2018_adb_anyuse.mxd but when I check sysTemp on the new server- sure enough public\ is empty.
So I'm a little stumped as to why the script seems to be having issues locating the source .mxd. The syntax in the python script seems to be here to look for the .mxd:
#If the data copied ok if continuePublish == True: mxdExist = False #Check for MXD for root, dirs, files in os.walk(pathInitial): for file in files: if file.endswith(".mxd"): mxdFile = os.path.join(root, file) mxdExist = True break;
Anyone have any thoughts or luck on this? Thanks for any help you can provide!
If you are using ArcGIS Server 10.6 or 10.7 this simple option might work for you as it did work for me recently.
I needed to move our maps services from ArcGIS 10.6 single server to ArcGIS 10.7 federated with Portal.. The script posted here did not work for me, though it worked perfectly well when i was moving from 10.5.1 standalone server environment to 10.6.1 standalone server environment.
If you are getting a Network Error, Just check the ports of the servers. I did experience that error when i was working with the stand alone server , if the ports are incorrect, you will get that error
So in my new situation what i did was to simply upgrade the ArcGIS 10.6.2 standalone server to ArcGIS 10.7, so i now have both servers running the same ArcGIS Server version which is 10.7. Then to move the map services across, I use the export and import tools in the Admin server and it worked very easily for me.
I do not know the ArcGIS Server environment you are working with but it is good to note that the script we are discussing above works only for Standalone server environment and cannot work for a federated server environment
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.