1

我正在调用 Google Geocoding Maps API,但它以某种方式向我抛出了以下错误:

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

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

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

4

1 回答 1

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

于 2012-10-11T06:28:33.503 回答