AnsweredAssumed Answered

Create LocalMapService Fails

Question asked by ereed on Oct 22, 2015
Latest reply on Oct 23, 2015 by ereed

Hello,

 

I want to add a layer on a map from a local service created from a map package. Here is the code:

 

        private async void LoadOfflineMapPackage()
        {
            try
            {
                string mpkPath = @"D:\mappackages\localservices\test.mpk";
                LocalMapService localMapService = new LocalMapService(mpkPath, 100000);
   
                await localMapService.StartAsync();
   
                ArcGISDynamicMapServiceLayer layer = new ArcGISDynamicMapServiceLayer()
                    {
                        ID = "localServiceLayer",
                        ServiceUri = localMapService.UrlMapService
                    };
                MyMapView.Map.Layers.Add(layer);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to create local service: " + ex.Message);

            }

        }

 

I get the following error on the StartAsync method:

 

Esri.ArcGISRuntime.Http.ArcGISWebException was caught

  HResult=-2146233088

  Message=Error code '500' : 'Failed to create service test MapServer. Worker process 'test_host' exited while attempting to service request (attempt 1 of 1): endpoint='admin' headers={} params={filePath=d:\mappackages\localservices\test.mpk, maxRecords=100000, name=test, outputDir=C:\Users\myuser\AppData\Local\Temp\arcgisruntime_12804\test, type=MapServer, virtualDir=http://127.0.0.1:50000/vnCNdS/outputdir/test} res='create' post=0 Crash dump path='

  Source=Esri.ArcGISRuntime

  Code=500.0

  StackTrace:

       at Esri.ArcGISRuntime.Http.ArcGISHttpClientHandler.ArcGISClientHandlerInternal.<SendAsync>d__2.MoveNext()

    --- End of stack trace from previous location where exception was thrown ---

       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

       at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

       at Esri.ArcGISRuntime.Http.ArcGISHttpClient.<GetStringAsync>d__0.MoveNext()

    --- End of stack trace from previous location where exception was thrown ---

       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

       at Esri.ArcGISRuntime.LocalServices.LocalService.<StartServiceInternal>d__2.MoveNext()

    --- End of stack trace from previous location where exception was thrown ---

       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

       at OfflineApp.MainWindow.<LoadOfflineMapPackage>d__8.MoveNext() in d:\ArcGISRuntimeApps\OfflineApp\OfflineApp\MainWindow.xaml.cs:line 172

  InnerException:

 

I have tried many things, but still have not been able to get it to run.

 

Does anyone know what the problem is?

 

Thanks,

 

Ed

Outcomes