【问题标题】:google map geocoding api webservice谷歌地图地理编码API网络服务
【发布时间】:2012-10-01 18:08:41
【问题描述】:

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

远程服务器返回错误:(407) Proxy Authentication Required

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

我正在调用这个网络服务:http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false"

【问题讨论】:

    标签: google-maps


    【解决方案1】:

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

    <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

    【讨论】:

    • 谢谢。上面的代码让我完成了之前给我一个错误但我的谷歌网络服务仍然无法工作的行。它向我返回了一个对象,但现在向我抛出了这个错误:“解析值时遇到意外字符:<.path line position>
    • 我认为代理有问题。是否需要配置代理以映射 maps.googleapis.com 域?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-05
    • 2011-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多