HttpWebRequest WebProxy 问题 - 连接意外关闭
我正在尝试通过开放的 SOCKS5 代理发出 HTTP 请求。 再将其设置为我的 C#.Net 应用程序中的代理。
我已通过设置 request.Proxy = new WebProxy(ip, port);
将其设置为 Firefox 的代理来验证该代理是否有效,然后 在尝试运行应用程序并提出请求时,我收到异常 - System.Net.WebException: 底层连接已关闭:连接意外关闭。
我不确定是什么原因导致此情况 -代理似乎是开放的并且工作正常。我也尝试过使用其他看似有效的代理,并得到相同的异常。任何关于为什么会发生这种情况以及我如何纠正它的线索将不胜感激!
I'm trying to make a HTTP request through an open SOCKS5 proxy. I have verified that the proxy works by setting it as a proxy for Firefox before setting it as the proxy in my C#.Net application by setting request.Proxy = new WebProxy(ip, port);
However, on attempting to run the application and make my request I get an exception - System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
I'm unsure what is causing this - the proxy seems to be open and working fine. I've also tried this with other seemingly working proxies and get the same exception. Any clues as to why this is happening and how I can go about rectifying it would be much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能。
检查这个
https://stackoverflow.com/questions/20366665/squid-proxy-reset-connection-immediately< /a>
You can not.
check this
https://stackoverflow.com/questions/20366665/squid-proxy-reset-connection-immediately
事实证明,
WebProxy
类不支持 Socks 代理,而这正是我想要使用的。多么有用啊!现在的问题是 - 如何使用 Socks Proxy for HttpWebRequest ?!
It turns out the
WebProxy
class does not support Socks proxies which is exactly what I was trying to use. How useful!The question now becomes - How to use a Socks Proxy for HttpWebRequest ?!