Hello,
I am trying to publish a map service to our own server using arcpy, however no matter what I try I always get and error during the exportToSDDraft function saying Error connecting to server.
My code follows pretty close to the code example on how to do it:
https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/mapservicedraft-class.htm#C_GUID-2D203747-6A5...
I am able to do this with arcpy version that came with ArcMap with no issues and ArcGIS Pro is able to connect and access the server without issue when using the program but it is unable to do it when calling it from python.
There is another post like this but the only reply mentions using an .ags file which I am already doing.
Any help or insight would be greatly appreciated.
I am facing the same issue. When I run the program through console it works fine without any issues but when I schedule to run overnight then it fails and gives me the error saying Cannot connect to Server.
Were you able to get any answer to this issue?
There are a few possible explanations I have found so far. In @PrayagShah's case, it sounds like maybe your connection file is configured to save the credentials in the Windows credential store. I would try saving them in the connection file.
I have also run into issues using HTTPS connections with self-signed certificates (at least I think that was the issue). Changing to HTTP solved it in that case. This should obviously only be done when using the server on the local network.