AnsweredAssumed Answered

Starting map service in Local Server?

Question asked by AltErica on Feb 19, 2019
Latest reply on Feb 19, 2019 by MBranscomb-esristaff

I am trying to get Local Server working in a Runtime 100.4 .NET application. Mostly I need this for a geoprocessing service, but am trying to get it working with a map service first (just so I can verify I've got everything wired correctly).


I have an mmpk that I generated in Pro, and it has a few polygons. If I just load it in (using MobileMapPackage.OpenAsync) it shows up on a basemap, so it seems to have the data I expect. However, I cannot get it to work with Local Server as a map service.


I have confirmed that the LocalServer instance is started up (based on Console.WriteLine outputs in the code of its status, and opening it up in a browser while my application is running.) However, the following code is resulting in an error.


Is the problem with my LocalServer, my map package, some step of setting up a map service that I'm missing, or something else?


string mmpkFilepath = @"C:\temp\qtz_sample_land.mmpk";

Console.WriteLine("> Opening Map Package");
// Open the map package
MobileMapPackage myMapPackage = await MobileMapPackage.OpenAsync(mmpkFilepath);
// Check that there is at least one map
if (myMapPackage.Maps.Count > 0)
    Console.WriteLine(" map package has maps");
    // Open the map package as a local service
    // Create a local feature service from a map package on disk
    LocalMapService mapService = new LocalMapService(mmpkFilepath);
    Console.WriteLine("> trying to start service");
    await mapService.StartAsync();
    // this is where I'd do other stuff, but it fails


  Message=Failed to create service qtz_sample_land MapServer. Service failed to initialize: IObjectConstruct::Construct (MapServer) hr=0x80043000 (ErrorInfo did not include a description)
   at Esri.ArcGISRuntime.LocalServices.LocalService.<StartServiceInternal>d__25.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at ESSQuartz_TracingGPK.MapViewModel.<StartServices>d__5.MoveNext() in C:\git\tester\ESSQuartz_TracingGPK\ESSQuartz_TracingGPK\MapViewModel.cs:line 111