HttpWebRequest的WebProxy问题 - 连接被意外关闭 [英] HttpWebRequest WebProxy problem - The connection was closed unexpectedly

查看:1050
本文介绍了HttpWebRequest的WebProxy问题 - 连接被意外关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让通过开放SOCKS5代理HTTP请求。我已验证代理的工作原理是将其设置为Firefox的代理设置 request.Proxy =新WebProxy(IP,端口)的设置它作为我的C#.NET应用程序代理之前;

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);

不过,在尝试运行该应用程序,使我的请求,我碰到一个例外 - 的 System.Net.WebException:基础连接已关闭:连接被意外关闭

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.

我不能确定是什么原因造成这一点 - 代理似乎是开放的,做工精细。我也试图与其他看似代理工作,并得到了同样的异常。至于为什么发生这种情况,我怎么能去纠正这将是更AP preciated!

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!

推荐答案

原来, WebProxy 类不支持SOCKS代理而这正是我试图用。如何用!

It turns out the WebProxy class does not support Socks proxies which is exactly what I was trying to use. How useful!

现在的问题是 - ?!如何使用 Socks代理的HttpWebRequest的

The question now becomes - How to use a Socks Proxy for HttpWebRequest ?!

这篇关于HttpWebRequest的WebProxy问题 - 连接被意外关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆