ex输出的错误就是An exception occurred during a WebClient request
ex输出的错误就是An exception occurred during a WebClient request FileDownload:Status:UnknownErrorFileDownload:error:An exception occurred during a WebClient request.FileDownload:error:System.Configuration.ConfigurationErrorsException: Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section. ---> System.DllNotFoundException: Unable to load DLL 'rasapi32.dll': 动态链接库(DLL)初始化例程失败。 (Exception from HRESULT: 0x8007045A) at System.Net.UnsafeNclNativeMethods.RasHelper.RasEnumConnections(RASCONN[] lprasconn, UInt32& lpcb, UInt32& lpcConnections) at System.Net.UnsafeNclNativeMethods.RasHelper.GetCurrentConnectoid() at System.Net.AutoWebProxyScriptEngine.AutoDetector.Initialize() at System.Net.AutoWebProxyScriptEngine.AutoDetector.get_CurrentAutoDetector() at System.Net.AutoWebProxyScriptEngine..ctor(WebProxy proxy, Boolean useRegistry) 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.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint) at System.Net.HttpRequestCreator.Create(Uri Uri) at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase) at System.Net.WebRequest.Create(Uri requestUri) at System.Net.WebClient.GetWebRequest(Uri address) at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
FileDownload:Status:UnknownErrorFileDownload:error:An exception occurred during a WebClient request.FileDownload:error:System.Configuration.ConfigurationErrorsException: Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section. ---> System.DllNotFoundException: Unable to load DLL 'rasapi32.dll': 动态链接库(DLL)初始化例程失败。 (Exception from HRESULT: 0x8007045A)
at System.Net.UnsafeNclNativeMethods.RasHelper.RasEnumConnections(RASCONN[] lprasconn, UInt32& lpcb, UInt32& lpcConnections)
at System.Net.UnsafeNclNativeMethods.RasHelper.GetCurrentConnectoid()
at System.Net.AutoWebProxyScriptEngine.AutoDetector.Initialize()
at System.Net.AutoWebProxyScriptEngine.AutoDetector.get_CurrentAutoDetector()
at System.Net.AutoWebProxyScriptEngine..ctor(WebProxy proxy, Boolean useRegistry)
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.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
at System.Net.HttpRequestCreator.Create(Uri Uri)
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)
at System.Net.WebClient.GetWebRequest(Uri address)
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
创建代理时出错,检查web.config system.net/defaultProxy配置节
<system.net>
<defaultProxy useDefaultCredentials="false">
<proxy usesystemdefault="True" bypassonlocal="True" autoDetect="True" />
</defaultProxy>
</system.net>如果有特定的代理服务器,设置
<proxy usesystemdefault="False" bypassonlocal="True" autoDetect="True" proxyaddress="IP:port" />
<system.net>
<defaultProxy useDefaultCredentials="false">
<proxy usesystemdefault="False"/>
</defaultProxy>
</system.net>