谷歌地图地理编码api webservice

时间:2012-10-11 06:25:26

标签: google-maps

我正在调用Google Geocoding Maps API,不知怎的,它给我发了以下错误:

远程服务器返回错误:(407)需要代理身份验证

我在Google网站上找不到任何关于我是否需要拥有Google地图密钥或需要创建帐户的文档?

我打电话给这个网络服务:http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false

1 个答案:

答案 0 :(得分:2)

您是否尝试将此添加到您的解决方案中?

<system.net>
  <defaultProxy enabled="true" useDefaultCredentials="true">
   <proxy bypassonlocal="True" proxyaddress="http://webproxy:80" />
  </defaultProxy>
</system.net>

或尝试以下

string url = “Valid URL”;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
NetworkCredential netcredit = new NetworkCredential(“user1″, “pass”, “domain”);
req.Credentials = netcredit;
System.Net.WebProxy pry = new WebProxy(“proxyServer”,true);
pry.Credentials = netcredit;
WebRequest.DefaultWebProxy = pry;
req.Method = “HEAD”; //Does not work if this line is not used
HttpWebResponse res = (HttpWebResponse)req.GetResponse();

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
NetworkCredential netcredit = new NetworkCredential(“user1″, “pass”, “domain”);
req.Credentials = netcredit;
System.Net.WebProxy pry = new WebProxy(“proxyServer”,true);
pry.Credentials = netcredit;
req.Proxy = pry;
req.Method = “HEAD”; //Does not work if this line is not used
HttpWebResponse res = (HttpWebResponse)req.GetResponse();

人们在这个论坛中有解决方案

https://groups.google.com/forum/?fromgroups=#!topic/google-maps-api/0js1jr4kqJw