We have published a service mistakenly with the data copied to the server rather than by reference. We moved the data to a registered folder on the server and tried to overwrite. However, it continues to fail with an error 001369 Failed to Create the Service and Failed to execute (Publish Service Definition). We are able to publish a new service as registered to the referenced folder. Is there any reason why the overwrite should fail when going from non referenced/copied data to referenced data?
ArcGIS Enterprise 10.8.1
Publishing from Pro 2.6.2
When you publish a service to ArcGIS server, its service workspace is defined somewhere in the configuration store. Once the service has been published, there is no way to change this either through the interface or programmatically. I would suspect that simply trying to overwrite the service definition to point to a new service workspace would fail, as not just the features but also the service definition and manifest would need to be changed.
As you have already discovered, I would encourage you to publish a new service using the desired service workspace, and then update your service URLs to reflect the new service.
Thank you for the response Calvin. Is this error expected because it was originally published as a copy and not by reference? We are planning to test publishing from a referenced folder, then changing the source to SDE and overwriting. I am expecting this should work. Am I wrong?
We have been having issues using the overwrite tool in general.
A method we have used to overcome this is the rename function via the server admin endpoint.
We re-publish the service using the same name with an "_new" at the end, such as "service_new". After testing the service to make sure it is functioning as we would like, we then rename the old service to have an "_old" and then remove the "_new" from the new service. After this we change the portal item IDs of the new service to match the old, remove the old service, then remove any new portal items that were generated in the process.
This means we only have a small outage on the service and are able to maintain the service name and portal item IDs.
Alternatively (I have not tried this for republishing but may be worth investigating), a service can be manipulated by retrieving the MSD file on the server, extracting (I use the 7zip software), manipulating the xml files which are extracted, then compressing again (using zip format and naming as a .MSD), replacing the .MSD on the server and restarting the service. We have managed to add in datum transformation information to the map.xml. There is xml files there specifically for the data.
Good luck and all the best