Bing maps Bing映射Web服务验证密钥

Bing maps Bing映射Web服务验证密钥,bing-maps,Bing Maps,我有一个插件,它使用bing地图的地理编码web服务来检索数据 这是我设置客户机的方式: BasicHttpBinding bindingBing = new BasicHttpBinding(BasicHttpSecurityMode.Transport); GeocodeServiceClient geocodeService = new GeocodeServiceClient(bindingBing, new EndpointAddress("https://dev.virtua

我有一个插件,它使用bing地图的地理编码web服务来检索数据

这是我设置客户机的方式:

  BasicHttpBinding bindingBing = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
  GeocodeServiceClient geocodeService = new GeocodeServiceClient(bindingBing, new EndpointAddress("https://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc"));
  geocodeService.InnerChannel.OperationTimeout = new TimeSpan(0, 0, 30);

  GeocodeResponse geocodeResponse = geocodeService.Geocode(geocodeRequest);

如果服务不可用或bing地图密钥无效,我不需要执行GeocodeResponse。现在,它尝试发出请求,但每次都失败。我不知道我的客户和我的回复之间遗漏了什么。有什么帮助吗?

您需要指定凭据。以下是一个例子:

GeocodeRequest GeocodeRequest=新的GeocodeRequest()


也就是说,您可能已经注意到Bing地图SOAP服务的文档不再在线。我想这是一个暗示。5年前,当REST服务发布时,我不再推荐Bing地图SOAP服务。REST服务速度更快,功能更多,响应大小更小,这意味着带宽使用更少。应该始终使用REST服务而不是SOAP服务。您可以在此处找到关于Bing地图REST服务的文档:其中还有关于如何在.NET中使用这些服务的信息。

谢谢!事实上,我不久前已经改为REST。我想你现在可能已经找到了解决方案,但我想确保如果其他人看到这篇文章,他们都有答案。我一直在努力清理Bing地图的堆栈溢出部分,因为在Bing地图团队不知道的情况下,这里有很多问题被问到,因为官方的Bing地图论坛已经获得了很多流量。
// Set the credentials using a valid Bing Maps key
geocodeRequest.Credentials = new GeocodeService.Credentials();
geocodeRequest.Credentials.ApplicationId = key;