If you have limited access to the server—for example, in a cloud environment or secure environment—you can create a service definition file that can be shared with a server administrator for publishing at a later time. A service definition file contains information about service properties, capabilities, and the service type, which is encapsulated in one portable file. Optionally, you can configure the service definition file to include the data referenced by your GIS resource.
For example, suppose you're a GIS analyst managing a geodatabase that is constantly being modified by dozens of editors. Every month, this data goes through a quality assurance process to ensure that it meets your organization's data integrity standards. After quality checking the data, you can capture the verified geodatabase with a service definition file and transfer it to your server administrator for publishing to an ArcGIS Server site.
Service definition files differ depending on whether you connect to an ArcGIS Server site or a portal organization when you create the service definition file. If you are connected to an ArcGIS Server site or choose the option to include the data referenced by your GIS resource when you create the service definition file, the file can only be used with an ArcGIS Server site; you cannot publish it to an ArcGIS Enterprise portal or ArcGIS Online. Similarly, if you are connected to an organization when you create the service definition file, you cannot publish the service definition file to an ArcGIS Server site.
You can publish a service definition file (.sd) from ArcGIS Server Manager.
Creating service definition files
In ArcGIS Pro, you can create service definition draft files (.sddraft) for map services, map image layers, web tile layers, and web feature layers using the arcpy.sharing module. You can also use functions to create .sddraft files for geocode services (CreateGeocodeSDDraft), geoprocessing services (CreateGPSDDraft), and image services (CreateImageSDDraft). After you have the draft file, you can use ArcPy to stage and upload the file to a server site.
Before you go through the process of creating a service definition file, consider the following scenarios:
If you have already configured a server connection
If you or your server administrator have already configured a server connection to use when publishing to ArcGIS Server, you can select this connection when creating the service definition file. Selecting this option creates a service definition file that your server administrator can immediately publish to an ArcGIS Server site.
If you specify a server connection when creating your service definition, you'll need to decide whether you want the data referenced by your GIS resource to be included with the file.
- If you do not want the service definition file to include the data referenced by your GIS resource, you'll need to register your data with the server before creating the file. Data registration provides the server with information about the location of your data and helps it adjust data paths when publishing across machines. When you publish, the service will continue to reference the original data included in your GIS resource. A separate copy is not maintained on the server.
- If you want the service definition to include the data referenced by your GIS resource, do not register your data with the server. All of the data referenced by your GIS resource is encapsulated in the service definition file. When you publish, the service and its associated data are uploaded to the server. Note that it is not possible to publish a service definition that includes data if the server has been set to not allow data to be copied when publishing.
If you are disconnected from the server or have limited access
If you are currently disconnected from the server or do not have access to a server connection, you can configure your service definition with no available connection to ArcGIS Server. In these workflows, you create a service definition file that needs to be configured to work with a server connection at the time of publishing.
If you do not specify a server connection when creating your service definition, you'll need to decide whether you want the data referenced by your GIS resource to be included with the file. If you don't, the data needs to be in a location that the ArcGIS Server site can access. The data location does not have to be registered with the server. When you publish, the service will continue to reference the original data included in your GIS resource. A separate copy is not maintained on the server.
When working with the arcpy.sharing module to create a service definition file, you can specify the offline property as true. This removes the requirement to provide a server URL or connection file.
Staging service definition files
The arcpy.sharing module and other ArcPy functions listed above create .sddraft files. Before you upload the service definition file to ArcGIS Server, you need to stage the file. The StageService function converts the .sddraft file to an .sd file that can be uploaded.
Publish a service definition file from ArcGIS Server Manager
You can use ArcGIS Server Manager to publish service definition files to ArcGIS Server.
- Open ArcGIS Server Manager and sign in to your ArcGIS Server site as a publisher or administrator.
- Click Services > Manage Services > Publish Service.
- Click the Browse button to browse to the service definition file you want to publish, or type the path to the file.
You can only browse the file system of the machine that is running Server Manager. If you want to browse to a location on another machine, map the drive before browsing.
Server Manager only allows you to publish service definition files (.sd) to the server.
- Click Next.
- Optionally, enter a new name for the service. The name cannot be more than 120 characters in length and must contain only alphanumeric characters and underscores.
- By default, the service definition is published to the server folder specified in the service definition configuration. If you want to change the folder where the service definition will be published, choose a folder from the drop-down list.
You cannot publish a service definition to the Hosted, System, or Utilities folders of ArcGIS Server. The System and Utilities folders are reserved for preconfigured services. The Hosted folder contains hosted services published to an ArcGIS Enterprise portal. This folder is only available if your ArcGIS Server site is a portal's hosting server.
- Only default clusters are supported, so leave Cluster set to default.
- If you want the service to be available immediately once publishing completes, choose to start the service immediately.
If your service definition file is configured with a cache tiling scheme and you choose to start the service immediately, you also have the option to build the cache automatically on the server when the service publishes and starts. To do this, select the Build cache automatically when service starts option.
- Click Next.
- Choose to enable or disable capabilities for your service.
- Click Publish.
If the service definition file you publish includes data, the size of the data and your network bandwidth impacts the time it takes to publish. Service definitions over 2 GB in size cannot be published using Mozilla Firefox; use Google Chrome or another supported browser for service definitions over 2 GB.
Your service is now running on your ArcGIS Server site. If you chose to start the service and the service is not cached, other users and clients on your network can start using the service. If your ArcGIS Server administrator has allowed web access to the service, your service is also now available on the web.
If you built the cache for your service automatically, you can view the status of your cache in Server Manager. For more information, see View cache completion status.