错误原因: 未配置代理服务器设置的问题, 需要在配置节做如下操作.
============================================
文章编号: 318140 - 查看本文应用于的产品机器翻译查看机器翻译免责声明逐句中英文参照视图Microsoft 支持页面的机器翻译展开全部 | 关闭全部Collapse image本文内容Collapse image症状注意:这篇文章中引用了以下.NET Framework 类库命名空间:
System.Net
当您使用.NET 客户端使用的 HTTP 代理服务器的 Web 服务时,您可能会收到以下错误消息:
基础连接已关闭: 无法解析此远程名称。回到顶端回到顶端 | 提供反馈Collapse image原因HTTP 代理服务器的 Web 服务,.NET 客户端之间不存在和尚未配置正确的代理服务器设置。回到顶端回到顶端 | 提供反馈Collapse image解决方案要解决此问题,请提供正确的代理向.NET 客户端配置设置。回到顶端回到顶端 | 提供反馈Collapse image更多信息Machine.config 文件中的默认设置如下:<configuration>
<system.net> <defaultProxy> <proxy usesystemdefault = "true" /> </defaultProxy> </system.net></configuration>默认设置不会自动检测代理服务器设置,如果将usessystemdefault设置为 false,然后显式指定的代理服务器。若要显式指定代理服务器,使用的 Machine.config 或 Web.config 文件,或以编程方式指定的服务器。
若要指定代理服务器,设置的 Machine.config 或 Web.config 文件设置,如下所述:
<configuration>
<system.net> <defaultProxy> <proxy usesystemdefault = "false" proxyaddress="http://proxyserver" bypassonlocal="true" /> </defaultProxy> </system.net></configuration>若要使用web 代理对象以编程方式更改设置,请使用下面的代码示例:
Using System.Net;
com.someserver.somewebservice.someclass MyWebServiceClass = new com.someserver.somewebservice.someclass();
IWebProxy proxyObject = new WebProxy("http://myproxyserver:80", true);
MyWebServiceClass.Proxy = proxyObject;MyWebServiceClass.MyWebMethod();
要求 NTLM 身份验证的代理服务器
若要设置 NTML 身份验证的代理服务器,请使用下面的代码示例:
Using System.Net;WebProxy myProxy = new WebProxy("http://proxyserver:port",true);
myProxy.Credentials = CredentialCache.DefaultCredentials; FindServiceSoap myFindService = new FindServiceSoap(); myFindService.Proxy = myProxy;您还可以使用系统范围的代理为默认值。<configuration> <system.net> <defaultProxy> <proxy proxyaddress = "http://proxyserver:80" bypassonlocal = "true" /> </defaultProxy> </system.net> </configuration>回到顶端回到顶端 | 提供反馈