ERROR 002760: Este archivo de definición de servicio se creó para una capa alojada y debe cargarse directamente en un portal mediante el sitio web del portal o ArcMap. Fallo en la ejecución (UploadServiceDefinition).
Estoy recibiendo el error anterior cuando estoy tratando de publicar un mxd a un portal como un servicio de características
import arcpy, os
# define local variables
wrkspc = 'C:/Ronit/Projects/DU/Hosted/'
path2MXD = r"C:\Ronit\Projects\DU\Hosted\temp.mxd"
mapDoc = arcpy.mapping.MapDocument(path2MXD)
con = 'GIS Servers/connection.ags
service = 'DemoHost'
sddraft = wrkspc + service + '.sddraft'
sd = wrkspc + service + '.sd'
summary = 'Population Density by County'
tags = 'county, counties, population, density, census'
arcpy.SignInToPortal_server("username", "password", "")
# create service definition draft
analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'MY_HOSTED_SERVICES', "", "", None, summary, tags)
# stage and upload the service if the sddraft analysis did not contain errors
if analysis['errors'] == {}:
# Execute StageService
arcpy.StageService_server(sddraft, sd)
# Execute UploadServiceDefinition
arcpy.UploadServiceDefinition_server(sd, con)
else:
# if the sddraft analysis contained errors, display them
print analysis['errors']
os.remove(sd)
"""