Select to view content in your preferred language

How to load a map document from a network path?

5432
12
Jump to solution
10-29-2012 01:10 PM
Labels (1)
GeorgeFaraj
Frequent Contributor
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"));
0 Kudos
12 Replies
jp
by
Emerging Contributor
Hi Mike,

I am working on similiar application adding shapefile dynamically to map.
But I am also trying to query this shapefile to access its geometry and attributes. I am sure it should be possible through - dynamicalayerinfo or dynamiclayerinfocollection.

Can suggest me a method to achieve this?

Thanks!
0 Kudos
TomasGogorza
New Contributor
Hello George,
Could you please tell me how you solved the issue?
I seem to be getting the same error but only on some machines.
Thank you
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi Mike,

I am working on similiar application adding shapefile dynamically to map.
But I am also trying to query this shapefile to access its geometry and attributes. I am sure it should be possible through - dynamicalayerinfo or dynamiclayerinfocollection.

Can suggest me a method to achieve this?

Thanks!


Hi,

Yes this is possible - you still use a QueryTask as you would with other service layer types, but make sure you set the Source property on the QueryTask so that it recognises the changes you have made to the service and uses your new service definition.

Cheers

Mike
0 Kudos