Bing地图:指定的凭据无效

use*_*289 3 bing bing-maps bing-api

我似乎无法让Bing从我的开发服务器接受我的API密钥 - 我已经从bingmapsportal.com网站设置了一个API密钥,并设置了URL http://localhost并成功生成了密钥.

然后,我按照API文档中的说明实现地图,如下所示:

<html>
<head>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
    function getMap(){
        var mapInitOpts = {
            credentials: 'mycredentials',
            mapTypeId: Microsoft.Maps.MapTypeId.road
        };
       var map = new Microsoft.Maps.Map(document.getElementById("map_canvas"), mapInitOpts);
     }
</script>
</head>
  <body onload="getMap();">
   <div id='map_canvas' style="position:absolute; top:0px; left:0px; width:100%; height:100%;"></div><br />
  </body>
</html>  

// map shows invalid credentials error
Run Code Online (Sandbox Code Playgroud)

但是,我总是得到"指定的凭据无效"消息.

有关这个问题的任何想法?

Boj*_* Li 5

假设您已'mycredentials'充当此问题发布的实际凭据的占位符,请尝试使用交互式SDK中的API密钥:

AjtUzWJBHlI3Ma_Ke6Qv2fGRXEs0ua5hUQi54ECwfXTiWsitll4AkETZDihjcfeI
Run Code Online (Sandbox Code Playgroud)

如果上述方法有效,并且您获得的密钥没有,那么您的密钥出现问题,您需要使用Bing Dev Support.

如果上面的密钥不起作用,那么您的开发环境有问题......