Bing Maps - WebException未处理

时间:2014-08-27 11:42:34

标签: c# windows-phone-7 bing-maps

我正在尝试在我的项目中实现bing贴图。我只需将地图拖放到地图页面。

现在我只需从主页面导航到Map页面。当加载map时,我得到了

的异常
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)

我没有做任何其他功能。只需导航到一个页面到另一个页面。请让我知道为什么会出现这种错误?

提前致谢..

1 个答案:

答案 0 :(得分: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>

现在工作正常。

感谢所有支持我找到问题的人。谢谢。