I was trying to create a custom Print Service to use with the ArcGIS API (Print task). I made my own python toolbox using ConvertWebMapToMapDocument. I added my arcgis connection file (.ags) to the "extra_conversion_options" parameter of the tool.
The ags file is the exact same one that I used to create a Print service using the built-in toolbox from ESRI, and this print service is working well.
I stored it under one of my registered folder on the server.
The toolbox compiles and works fine locally (it does not ask for credentials). However whatever I do, when it is published as a service, I always get an error :
"RuntimeError: Layer "....": Unable to connect to map server at "
Even weirder, some of the feature services I add to the map, seem to print ok while most don't. They are all secured the same way, and stored at the same place.
Hi Matthieu, sorry to hear about the trouble. It sounds like you are publishing a custom print service, from ArcMap to ArcGIS Enterprise, is that correct?
And the custom print service that you published, always throws the error you mentioned, but it also prints some layers, but not others? And all layers are secure. Is that correct?
I also recommend 2 things:
1) Can you try this same workflow from ArcGIS Pro instead of ArcMap?
2) Try posting your question in the ArcGIS Enterprise space, as you may get better results from someone more familiar with publishing services.
It turns out we just figured it out. It was linked to the way we used to create server connection file, and in particular the way we specified the server URL.
We were typically using either:
We had to use https://webadaptorhost.domain.com/webadaptorname/services instead. This was a simple fix, which took us 2 years to figure out.