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
Could you upload your map package so that I can take a quick look at it? Also, what version was your map package created against and did you use the user interface to create it or the Package Map geoprocessing tool?
Freddie,
The mpk was created using ArcMap 10.3.1 Share as => Map Package.
How do I upload it?
Thanks,
Ed
Hi,
Have you applied the patch? ArcGIS 10.3.1 for Desktop Package Map For ArcGIS Runtime Patch | Samples and Utilities
Cheers
Mike
Michael,
I just applied the patch, re-created the map package, but I am still getting the same error message.
Thanks,
Ed