Map Service Won't Publish from ArcMap or Python

808
10
06-06-2017 11:47 AM
LloydBronn
Occasional Contributor II

I'm trying to publish a map service from ArcMap (10.3). It sits at 0% on "analyzing service" forever before I have to close ArcMap in the task manager. If I try to publish from Python, it creates a 51KB service definition file and then Python crashes. I'm getting no errors and nothing shows up in the ArcGIS server logs. This service has five layers, two of which are time enabled NetCDF rasters, and one that is a graphics layer. I'm not sure how to proceed. 

0 Kudos
10 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Llyod,

I would try removing a layer, and then attempt to Analyze the service.  You can continue to do this until the service analyzing successfully.  This will help you narrow down if it's a particular layer causing the issue. 

0 Kudos
LloydBronn
Occasional Contributor II

When I run the Python script, it creates the sd draft in a documents folder in addition to a folder named "0." The layers and geodatabase associated with the service get copied in there. I noticed Python crashed when the MXD was copied into this folder. I'll save it with a new name in case it's corrupted. 

0 Kudos
LloydBronn
Occasional Contributor II

Yes, no matter what layers are removed from the MXD, the script fails once the MXD is copied into this "0" folder.

0 Kudos
JonathanQuinn
Esri Frequent Contributor

It's still not clear whether it's data, map, or environment specific.  What happens if you add some very simple data to a new map, save it, then run the script against the new map?  If that works, then you can try to add your other layers into the new map and try again.  Last resort if things keep crashing, you can try on a different machine, as it may be related to Python/arcpy on the machine.

0 Kudos
LloydBronn
Occasional Contributor II

It's definitely not ArcMap or ArcPy on the machine. We have a couple dozen map services that publish to our server daily, and they've all been fine. This is the only map that contains a graphics layer and NetCDF files. That shouldn't matter, should it?

We just made sure that the layers all had the same coordinate system, and the data frame is projected in WGS 1984 World Mercator. It's still freezing up during analysis in ArcMap and crashing in Python. The server doesn't have any log messages. 

0 Kudos
LloydBronn
Occasional Contributor II

I clicked "analyze map" in the file menu on the MXD. Apparently there was a hidden data table with a missing source in the table of contents.

MichaelVolz
Esteemed Contributor

So when you analyzed the mxd during the initial publishing process, the Analyze button for the ArcGIS for Server toolbar did not show you that there was a hidden data table with a missing source?

I thought the Analyze button was supposed to display this type of warning (error).

JonathanQuinn
Esri Frequent Contributor

Ideally, your script would have a section that analyzes the sddraft after creating it:

CreateMapSDDraft—Help | ArcGIS for Desktop 

Ex.

# create service definition draft
analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'ARCGIS_SERVER', 
                                          con, True, 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']

It sounds like a bug if the analysis is missing the fact that a table in the map document has a broken data source.

0 Kudos
LloydBronn
Occasional Contributor II

My script does have that section, so it was definitely not catching that missing data source. I got the service to publish, but all the layers except for one are missing. I'll try again. 

0 Kudos