我希望通过代理进行身份验证,但是获得了错误:成功。如果我不使用代理,请求就会正常工作。代理数据是正确的,我已经用curl测试过了。请求只在https中失败。
var p = new WebProxy(ProxyUrl, ProxyPort)
{
Credentials = new NetworkCredential(ProxyUsername, ProxyPassword)
};
var req = WebRequest.Create("https://api.ipify.org/?format=json");
req.Proxy = p;
req.GetResponse();错误日志:
Unhandled Exception:
System.Net.WebException: Error: Success
at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00064] in <bd46d4d4f7964dfa9beea098499ab597>:0
at System.Net.HttpWebRequest.GetResponse () [0x0000e] in <bd46d4d4f7964dfa9beea098499ab597>:0
...
Process finished with exit code 1.控制台应用程序.net v4.6.1
发布于 2019-05-19 19:39:56
问题出在Mono,我有4.6.2版本。因此,我从https://www.mono-project.com/download/stable/安装了最新版本(5.20.1.19),问题就解决了。
https://stackoverflow.com/questions/56068763
复制相似问题