在生产服务器(Windows Server 2003 SP2)上,我可以使用Internet Explorer 8连接到远程WCF服务:当浏览到URL http://www.domain.com/Service.svc(我的服务侦听的地方)时,显示所需服务的信息页面。 Internet Explorer中的连接设置仅指定“自动检测”,禁用代理设置。浏览器连接到WCF服务,但不是我的WCF客户端。可能是什么原因?
如果我在同一台服务器上启动一个控制台应用程序(使用.NET 4.0中的WCF构建),该服务器也尝试连接到相同的WCF服务,但它告诉我在http://www.domain.com/Service.svc上没有可用的终端节点。
配置WCF客户端的:
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMyService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://www.domain.com/Service.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService"
contract="Service.IMyService" name="WSHttpBinding_IMyService" />
</client>
</system.serviceModel>
<configuration>
通过这些设置,我可以从我的开发机器的远程服务通信成功。
四处寻找其他的选择,我发现我可以指定要使用的Internet Explorer代理设置有:
<system.net>
<defaultProxy>
<proxy usesystemdefault="true" />
</defaultProxy>
</system.net>
它没有工作,我不知道如果我真的理解正确此设置。 (我的希望是,WCF客户端将采用IE浏览器的“自动检测”设置,然后以同样的方式连接到像安装了IE的服务。)
我也有切换在真实之间的绑定配置的useDefaultWebProxy
设置并没有成功的假。
现在我正在寻求帮助,我可以做些什么?哪些设置可能错误或丢失?我可以测试什么?如何获得更详细的错误信息以更好地识别问题?
预先感谢您!
编辑:
堆栈中Innerexception
是说:
- System.Net.WebException:连接到远程服务器无法建立
- 的System.Net.Sockets。 SocketException:连接失败,因为主机在一段时间后没有应答,或连接出现故障,因为连接的主机没有回答。
我知道这个线程很旧,但我一直在遇到这个问题,并最终在这里。我仍然不明白为什么“UsesSystemDefault = true”设置不起作用 - 如果逻辑成立,它应该导致WCF服务使用IE配置的代理设置 - 但它不是;代理地址仍然需要在WCF客户端中显式配置。任何人对此有解释? – PIntag 2015-03-27 15:52:05