下面是错误信息:
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就异常了
不使用代理,则将代理赋值为null,framework版本低的就使用全局类去获取systemdefaultproxy