Cannot load map package using ArcGIS Runtime .Net for WPF local service

611
2
12-04-2017 01:32 PM
tanzi
by
New Contributor

I am trying to load a local map package to the main window using ArcGIS Runtime .Net for WPF (Version 100.1). But somehow the local server cannot find layers in the map package. Here's my script:

        public MainWindow()
        {        
         InitializeComponent();
         StartLocalServer();    
         }     

         private Esri.ArcGISRuntime.LocalServices.LocalServer _localServer;
         private async void StartLocalServer()
         {                    
            _localServer = Esri.ArcGISRuntime.LocalServices.LocalServer.Instance;
            await _localServer.StartAsync();
            var mapService = new Esri.ArcGISRuntime.LocalServices.LocalMapService(@"C:\mappackage.mpk");
            await mapService.StartAsync();
            var mapServiceUrl = mapService.Url; 
         }

I checked the generated url of the local service and not a single layer in that map package was found. See the screenshot here:

  

The map package was created in ArcMap 10.5.1 with Runtime support enabled. It contains point layer, polyline layer, and polygon layer. 

I am using Visual Studio 2012 in Windows 7 SP1.

Any help would be appreciated! Thank you!

0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

What type of data is in your map package? By default the Local Server deployment created when you build your project contains only the default/minimum resources required. Some data formats, such as shapefiles, raster data, and enterprise geodatabase data require you to specify additional deployment options in the deployment config file. For more information see Create a Local Server deployment—ArcGIS Runtime SDK for .NET (WPF) | ArcGIS for Developers.

As a quick test, I'd recommend changing `<Package name="Local Server" enabled="true">` to `<Package name="Local Server" enabled="false">`. And then running a Rebuild or Clean/Build on your project. That will cause the API to use the central installation of the Local Server SDK in `%ProgramFiles(x86)%\ArcGIS SDKs\LocalServer100.1`, where all the resources are present. Once you have confirmed that works, then read the doc above to determine which deployment option(s) you need.

Cheers

Mike

0 Kudos
tanzi
by
New Contributor

Hi Mike,

Thank you! That's exactly the reason!

0 Kudos