首页 新闻 搜索 专区 学院

ftp访问失败的问题System.Net.WebProxy.

0
[已解决问题] 解决于 2012-11-16 10:09

下面是错误信息:

System.Configuration.ConfigurationErrorsException: Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section. ---> System.FormatException: The system proxy settings contain an invalid proxy server setting: 'http=127.0.0.1:9988,https=127.0.0.1:9986'.
   at System.Net.WebProxyDataBuilder.ParseProtocolProxies(String proxyListString)
   at System.Net.WebProxyDataBuilder.SetProxyAndBypassList(String addressString, String bypassListString)
   at System.Net.RegBlobWebProxyDataBuilder.BuildInternal()
   at System.Net.AutoWebProxyScriptEngine.GetWebProxyData()
   at System.Net.WebProxy.UnsafeUpdateFromRegistry()
   at System.Net.WebProxy..ctor(Boolean enableAutoproxy)
   at System.Net.Configuration.DefaultProxySectionInternal..ctor(DefaultProxySection section)
   at System.Net.Configuration.DefaultProxySectionInternal.GetSection()
   --- End of inner exception stack trace ---
   at System.Net.Configuration.DefaultProxySectionInternal.GetSection()
   at System.Net.WebRequest.get_InternalDefaultWebProxy()
   at System.Net.FtpWebRequest.get_ServicePoint()
   at System.Net.FtpWebRequest.GetResponse()

 

看样子是web代理弄错了,ie上访问了下ftp是能正常访问的。这个是什么问题呀?

 

 

连接的代码贴下:

 reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(_RemoteFtpURI));
                reqFTP.UseBinary = true;
                reqFTP.Credentials = new NetworkCredential(_RemoteFtpUserID, _RemoteFtpPassword);
                reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
                reqFTP.Timeout = 10000;
                WebResponse response = reqFTP.GetResponse();

到GetResponse就异常了

噹里个噹的主页 噹里个噹 | 菜鸟二级 | 园豆:202
提问于:2012-11-08 16:10
< >
分享
最佳答案
1

不使用代理,则将代理赋值为null,framework版本低的就使用全局类去获取systemdefaultproxy

噹里个噹 | 菜鸟二级 |园豆:202 | 2012-11-16 10:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册