我试图使用WebClient.DownloadString(),但使用代理。 Im做这样的:WebClient DownloadString在使用Webproxy时出错C#
WebProxy wp = new WebProxy("http://000.000.000.000:80"); (here goes real proxy ip)
WebClient wb = new WebClient();
wb.Proxy = wp;
try
{
string file = wb.DownloadString("http://google.com/");
System.Console.WriteLine(file);
}
catch (Exception e)
{
System.Console.WriteLine(e);
}
,它给DownloadString当这个错误是调用:
System.Net.WebException:硒公顷terminado LA conexion:错误inesperado德recepcion。 ---> System.IO.IOException:没有指定传输的数据:Se ha forzado la Interrupcion de una conexion existente por el host remoto。 ---> System.Net.Sockets.SocketException:Se ha forzado la Interrupcion de una conexion existente por el el host remoto
如果我不使用代理,它工作正常。该代理也工作正常,因为如果我在Chrome或Firefox配置代理,我可以访问任何网页。
感谢
Erm ...没有puedo hablarEspañol。你能把它翻译成美国人吗? – Aron 2013-03-20 03:28:50
这会让翻译好吗? System.Net.WebException:无法连接到远程服务器---> System.Net.Sockets.SocketException:无法建立连接,因为目标机器主动拒绝它120.203.215.6:85 – Aron 2013-03-20 03:32:30
不要忘记删除知识产权从您的评论。 – Prix 2013-03-20 03:34:48