Local server services
Demonstrates how to start and stop the Local Server and start and stop a local map, feature, and geoprocessing service running on the Local Server.
Note: Local Server is not supported on macOS.
How to use the sample
Start Local Server to start the Local Server. Click
Stop Local Server to stop the Local Server. The
Map Service combo box lets you to pick a local service that is available. After browsing for the desired file, click
Start Service to start the selected service. When the running service's Url appears, select it and click
Open Url. To stop this running service, click
How it works
To start a
LocalServer and start a
LocalService to it:
- Create it with
LocalServer::start()to start the server asynchronously.
LocalServer::statusChanged()fires whenever the running status of the Local Server changes. Wait for the server to be in the
- Create and run a local service. Here is an example of running a
new LocalMapService(Url)creates a local map service with the given URL path to map package (
LocalMapService::start()starts the service asynchronously.
- The service is added to the
To stop a
LocalServer and stop any
LocalServices that are added to it:
- Get any services that are currently running on the local server with
- Loop through all services and stop the selected service (from the dropdown) if it is started.
LocalService::status()to check if the service's status is
LocalService::stop()stops the service asynchronously.
LocalService::statusChanged()fires whenever the running status of the local service has changed. Wait for all services to be in the
- Stop the local server with
Read more about how to set up the sample's offline data here.
|PointsOfInterest map package||
|MessageInABottle geoprocessing package||