Error: Error 001360: Failed to get basic item metadata for service definition upload
Attempts to publish a service definition to ArcGIS for Server via ArcMap returns the following error:
Error 001360: Failed to get basic item metadata for service definition upload.
This error may occur due to one or more of the following causes:
The service definition (.sd) file is not successfully written by ArcMap. This causes the file to be corrupted. Subsequently, when publishing the corrupted .sd file to ArcGIS for Server, ArcGIS for Server is unable to acknowledge the .sd file as a valid service definition file.
ArcGIS for Server may encounter issues processing the .sd file. This issue occurs due to the lack of system resources, hampering the system's ability to process the request. For example, insufficient storage space on the system where ArcGIS for Server is installed, or the service is interrupted during the upload process.
ArcGIS for Server does not have permission and access rights to the location of the staging folder where the service definition file is stored by ArcMap.
Solution or Workaround
Depending on the cause, apply one or more of the following workarounds as necessary:
Republish the service definition file
As the publishing process may fail intermittently, the following is a Python script that utilizes a while loop to automate the republishing process continuously until the service definition file is successfully published. To do so, copy the following code block into the Python console in ArcMap and execute the script:
from arcpy import env
# Execute UploadServiceDefinition. This uploads the service definition and publishes the service.
status = 1
while status <= 1:
arcpy.UploadServiceDefinition_server(<workspace parameter>, <server connection>)
status = 2
print "Service successfully published"
print "Service failed to publish"
status = 0
Ensure that the ArcMap default Staging folder for publishing service definitions is accessible by the ArcGIS for Server account. In the event the permissions settings cannot be modified, an alternative is to upload the .sd file to ArcGIS for Server Manager, and publish the service through ArcGIS for Server Manager.