简体   繁体   English

通过地理编码 API 的 Web 请求出现错误 407(代理身份验证请求)

[英]Error 407 (Proxy Authentication Request) on Web Request via Geocoding API

I'm writing a piece of code that will take in addresses input by the user, and return the latitude/longitude values for later use.我正在编写一段代码,它将接收用户输入的地址,并返回纬度/经度值供以后使用。 For this, I'm using the Geocoding API.为此,我使用了地理编码 API。 What I have is:我所拥有的是:

try
{
    IGeocoder geo = new GoogleGeocoder() { };
    Address[] addresses = geo.Geocode(address.Text).ToArray();
    foreach (Address adr in addresses)
    {
        // just testing it out
        MessageBox.Show(adr.Coordinates.ToString());
    }
}
catch (Exception ex)
{
    // error treating
}

address is a Textbox where the user types in the addresses. address是一个文本框,用户可以在其中输入地址。 However, I get the 407 Error when I run it.但是,运行时出现 407 错误。

I've read many questions and tried their solutions (like this one , or this one ), but none have worked.我已经阅读了很多问题并尝试了他们的解决方案(比如这个,或者这个),但没有一个奏效。

Any ideas on what I'm missing?关于我缺少什么的任何想法?

Since it is throwing an error regarding proxy, you can try setting your proxy details to GoogleGeocoder class .由于它抛出有关代理的错误,您可以尝试将代理详细信息设置为GoogleGeocoder 类

GoogleGeocoder geocoder = new GoogleGeocoder
{
    Proxy = new WebProxy
    {
        Address = new Uri("proxy url"),
        Credentials = new NetworkCredential("username", "password")
    }
};

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过 C#、Exchange 和 EWS 托管 API 发送电子邮件会出现错误 407:请求失败 - 需要代理身份验证。 为什么? - Sending e-mail through C#, Exchange and EWS Managed API gives error 407: Request failed - Proxy authentication required. Why? 调用Web服务时出现HTTP 407代理身份验证错误 - HTTP 407 proxy authentication error when calling a web service API-HttpResponseMessage:需要(407)代理身份验证 - API - HttpResponseMessage: (407) proxy authentication required 错误(407)“需要代理验证”。 - error (407) “Proxy Authentication Required.” request.GetResponse(); 即使提供了正确的凭据也返回407(需要代理身份验证) - request.GetResponse(); returns 407 (Proxy Authentication Required) even though correct credentials are supplied HTTP状态407:需要代理身份验证调用Web服务时出错 - HTTP status 407: Proxy authentication required Error when calling web service (407)需要代理验证 - (407) Proxy Authentication Required 在Windows域用户环境中通过代理进行POST时,C#中的Fluent出现(407)代理身份验证必需错误 - Flurl in C# get (407) Proxy Authentication Required error when POST via proxy in Windows Domain User environment .net Framework 3.5的httpwebrequest代理身份验证返回407错误 - httpwebrequest proxy authentication with .net framework 3.5 return 407 error 远程服务器返回错误:(407)需要代理身份验证 - Remote Server returned an error: (407) Proxy Authentication Required
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM