Local server services

View on GitHubSample viewer app

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.

Image of local server services

Use case

For executing offline geoprocessing tasks in your ArcGIS Runtime apps via an offline (local) server.

How to use the sample

Click Start Local Server to start the Local Server. Click Stop Local Server to stop the Local Server.

The Map Service control 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 Navigate to service. To stop this running service, click Stop Service.

How it works

To start a LocalServer and attach a LocalService:

  1. Create and run a local server with LocalServer.Instance.
  2. Start the server asynchronously with server.StartAsync().
  3. Create and run a local service. Here is an example of running a LocalMapService:
    1. Instantiate LocalMapService(Url) to create a local map service with the given URL path to map package (mpk or mpkx file).
    2. Start the job with LocalMapService.StartAsync(). The service is added to the LocalServer automatically.
  4. Stop the local server with LocalServer.Instance.StopAsync().

Relevant API

  • LocalFeatureService
  • LocalGeoprocessingService
  • LocalMapService
  • LocalServer
  • LocalServerStatus
  • LocalService

Offline data

Additional information

Local Server can be downloaded for Windows and Linux platforms from the developers website. Local Server is not supported on macOS.

Tags

feature, geoprocessing, local services, map, server, service

Sample Code

LocalServerServices.xamlLocalServerServices.xamlLocalServerServices.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<UserControl x:Class="ArcGISRuntime.WPF.Samples.LocalServerServices.LocalServerServices"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Button x:Name="LocalServerStartButton"
                Grid.Row="0"
                Grid.Column="0"
                Margin="5"
                Click="StartServerButtonClicked"
                Content="Start Local Server" />
        <Button x:Name="LocalServerStopButton"
                Grid.Row="0"
                Grid.Column="1"
                Margin="5"
                Click="StopServerButtonClicked"
                Content="Stop Local Server"
                IsEnabled="False" />
        <ComboBox x:Name="ServiceSelectionCombo"
                  Grid.Row="1"
                  Grid.Column="0"
                  Grid.ColumnSpan="2"
                  Margin="5"
                  IsEnabled="False"
                  SelectionChanged="Selector_OnSelectionChanged">
            <ComboBoxItem>Map Service</ComboBoxItem>
            <ComboBoxItem>Feature Service</ComboBoxItem>
            <ComboBoxItem>Geoprocessing Service</ComboBoxItem>
        </ComboBox>
        <Button x:Name="ServiceStartButton"
                Grid.Row="2"
                Grid.Column="0"
                Margin="5"
                Click="StartServiceButtonClicked"
                Content="Start service"
                IsEnabled="False" />
        <Button x:Name="ServiceStopButton"
                Grid.Row="2"
                Grid.Column="1"
                Margin="5"
                Click="StopServiceButtonClicked"
                Content="Stop service"
                IsEnabled="False" />
        <TextBox x:Name="StatusTextbox"
                 Grid.Row="3"
                 Grid.Column="0"
                 Grid.ColumnSpan="2"
                 Margin="5" />
        <ListBox x:Name="ServicesListbox"
                 Grid.Row="4"
                 Grid.Column="0"
                 Grid.ColumnSpan="2"
                 Margin="5" />
        <Button Grid.Row="5"
                Grid.Column="0"
                Grid.ColumnSpan="2"
                Margin="5"
                Click="NavigateButtonClicked"
                Content="Navigate to service" />
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.