2014-08-27 56 views
0

我想實現我的項目Bing地圖。我只需將地圖拖放到地圖頁面即可。Bing地圖 - 引發WebException了未處理

現在我只是從主網頁導航到地圖頁面。當地圖加載我得到的例外是

WebException was unhandled 

錯誤消息:

System.Net.WebException was unhandled 
    Message=The remote server returned an error: NotFound. 
    StackTrace: 
     at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) 
     at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 
     at SharpGIS.GZipHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 
     at Microsoft.Phone.Controls.Maps.Map.LogResponse(IAsyncResult result) 
     at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.<InvokeGetResponseCallback>b__8(Object state2) 
     at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadPool.WorkItem.doWork(Object o) 
     at System.Threading.Timer.ring() 
    InnerException: System.Net.WebException 
     Message=The remote server returned an error: NotFound. 
     StackTrace: 
      at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 
      at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass2.<EndGetResponse>b__1(Object sendState) 
      at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState) 
      at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark) 
      at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark) 
      at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) 
      at System.Delegate.DynamicInvokeOne(Object[] args) 
      at System.MulticastDelegate.DynamicInvokeImpl(Object[] args) 
      at System.Delegate.DynamicInvoke(Object[] args) 
      at System.Windows.Threading.Dispatcher.<>c__DisplayClass4.<FastInvoke>b__3() 
      at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark) 
      at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark) 
      at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) 
      at System.Delegate.DynamicInvokeOne(Object[] args) 
      at System.MulticastDelegate.DynamicInvokeImpl(Object[] args) 
      at System.Delegate.DynamicInvoke(Object[] args) 
      at System.Windows.Threading.DispatcherOperation.Invoke() 
      at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority) 
      at System.Windows.Threading.Dispatcher.OnInvoke(Object context) 
      at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args) 
      at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args) 
      at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult) 

我沒有做任何其他的功能。只需導航到一頁到另一頁。請讓我知道爲什麼會發生這個錯誤?

在此先感謝..

+0

你在拖放什麼東西?這是一些預製的小工具嗎? Bing地圖需要編寫代碼,並且不會拋出您顯示的任何錯誤。 – rbrundritt 2014-08-27 11:50:57

+0

一個例外的圖片是沒用的。有一個鏈接你對對話框的權利,可以讓你將異常細節複製到剪貼板。然後你可以用它做點什麼,比如,我不知道...將它粘貼到[edit]中?或者你可以將它粘貼到記事本中並拍攝照片。 – Will 2014-08-27 12:28:56

+0

@rbrundritt ..我不知道如何解釋我的問題。我的XAML是'<電網X:NAME = 「MapPageUIContainer」 Grid.Row = 「1」 保證金= 「2,0,2,0」> <我:地圖HEIGHT = 「682」 的Horizo​​ntalAlignment = 「左」 保證金=」 0,86,0,0「Name =」map1「VerticalAlignment =」Top「Width =」476「/> '。我只是從主頁面導航到地圖頁面。當我來到地圖頁面時,它會拋出一個錯誤。 – Vijay 2014-08-27 12:33:17

回答

2

關鍵是問題所在。現在只有我意識到Bing Map Key對於實時項目非常重要。現在我清除了我的問題。

<Grid x:Name="MapPageUIContainer" Grid.Row="1" Margin="2,0,2,0">   
      <my:Map Height="688" HorizontalAlignment="Left" Margin="0,80,0,0" Name="map1" VerticalAlignment="Top" Width="478" CredentialsProvider="My Key"/> 
     </Grid> 

現在它工作正常。

感謝所有對我給予支持,以發現問題。謝謝。