【发布时间】:2012-06-08 12:55:09
【问题描述】:
我必须从我的 WCF 服务库调用第三方 Web 服务。当我从测试应用程序调用第三方 Web 服务时,没有问题,但是当我从我的 WCF 服务调用时,出现错误:
接收对 xxx.svc/ws 的 HTTP 响应时出错。 这可能是……
我添加了带有Add Service Reference 的第三方网络服务。该 Web 服务的绑定会自动生成为:
<wsHttpBinding>
<binding name="WSHttpBinding_xxxService" 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>
我的 WCF 服务的绑定不同:
<basicHttpBinding>
<binding name="basicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
我的 WCF 服务的绑定在测试 app.config 文件中自动生成,但第三方服务的绑定仅在 WCF appl 配置中生成。
我做错了什么?
【问题讨论】:
-
您能告诉我们您用来调用该第三方网络服务的代码吗?您向我们展示的配置似乎很好 - 除了我们只看到绑定 - 没有别的。您没有向我们展示客户端端点配置(URL、合同等)
-
在 WCF 服务和测试程序中,我尝试以相同的方式调用它: xxx_Ws.xxxClient client = new xxxClient(); client.Function();
-
跟踪无响应服务的活动可以让您/我们了解为什么没有响应。还要确保您没有达到这些配额。
-
开启wcf trace获取更多信息blogs.msdn.com/b/madhuponduru/archive/2006/05/18/601458.aspx
标签: wcf web-services