AnsweredAssumed Answered

How to load a map document from a network path?

Question asked by ccposton on Oct 29, 2012
Latest reply on Sep 26, 2013 by MBranscomb-esristaff
I'm trying to load a map package, i.e load every layer contained in the map package (mpk file). This map package is in a shared network path. I've tried several ways of doing this, but I haven't found why this is failing.

This is all I get:

ESRI.ArcGIS.Client.Local.LocalServerException was unhandled   Message=Failed to create service clark MapServer. Service failed to initialize: IObjectConstruct::Construct (MapServer) hr=0x80043000 (ErrorInfo did not include a description) Error code: 500   Source=ESRI.ArcGIS.Client   StackTrace:        at ESRI.ArcGIS.Client.Layer.OnInitializationFailed(EventArgs e)        at ESRI.ArcGIS.Client.Layer.Initialize()        at ESRI.ArcGIS.Client.FeatureLayer.Initialize()        at ESRI.ArcGIS.Client.Local.ArcGISLocalFeatureLayer.FailInitialize(Exception error)        at ESRI.ArcGIS.Client.Local.ArcGISLocalFeatureLayer.CompleteServiceInitialize(LocalMapService mapService)        at ESRI.ArcGIS.Client.Local.LocalMapService.<>c__DisplayClass1.<GetServiceAsyncInternal>b__0(Object s, AsyncCompletedEventArgs e)        at ESRI.ArcGIS.Client.Local.LocalService.OnStartCompleted()        at ESRI.ArcGIS.Client.Local.LocalService.FailStart(Exception error)        at ESRI.ArcGIS.Client.Local.LocalService.<ContinueStartService>b__a(CreateServiceResponse createServiceResponse, RequestInfo createServiceInfo)        at ESRI.ArcGIS.Client.Local.Internal.Requests.ProcessResponse[TExpectedResponse](String url, String queryParameters, Exception err, Boolean cancelled, String result, Action`2 callback)        at ESRI.ArcGIS.Client.Local.Internal.Requests.<>c__DisplayClass7`1.<Start>b__2(Object s, UploadStringCompletedEventArgs e)        at System.Net.WebClient.OnUploadStringCompleted(UploadStringCompletedEventArgs e)        at System.Net.WebClient.UploadStringOperationCompleted(Object arg)        at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)        at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)        at System.Windows.Threading.DispatcherOperation.InvokeImpl()        at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)        at System.Threading.ExecutionContext.runTryCode(Object userData)        at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)        at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)        at System.Windows.Threading.DispatcherOperation.Invoke()        at System.Windows.Threading.Dispatcher.ProcessQueue()        at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)        at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)        at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)        at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)        at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)        at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)        at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)        at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)        at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)        at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)        at System.Windows.Application.RunDispatcher(Object ignore)        at System.Windows.Application.RunInternal(Window window)        at System.Windows.Application.Run(Window window)        at System.Windows.Application.Run()        at AdvancedRuntimeControls.App.Main() in C:\Users\gfaraj\Desktop\Source_Code\AdvancedRuntimeControls\obj\Debug\App.g.cs:line 0        at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)        at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)        at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()        at System.Threading.ThreadHelper.ThreadStart_Context(Object state)        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)        at System.Threading.ThreadHelper.ThreadStart()   InnerException: 




The code:

    
LocalMapService localMapService = new LocalMapService() {  Path = @"\\dtdev7240w7\Terminated\GIS Data\clark gis\clark.mxd",  MaxRecords = 100000 }; localMapService.StartAsync(localService => {  if (localService.Error != null)   return;  ArcGISLocalDynamicMapServiceLayer layer = new ArcGISLocalDynamicMapServiceLayer(localMapService);  MyMap.Layers.Add(layer); });



Other attempt:

MyMap.Layers.Add(new ArcGISLocalFeatureLayer(@"\\dtdev7240w7\Terminated\GIS Data\clark gis\clark.mxd", "Clark"));

Outcomes