从wcf服务调用第三方web服务
我必须从我的WCF服务库调用第三方web服务。从测试应用程序调用第三方web服务时,没有问题,但从WCF服务调用时,出现错误: 接收对xxx.svc/ws的HTTP响应时出错。 这可能是 我已使用从wcf服务调用第三方web服务,wcf,web-services,Wcf,Web Services,我必须从我的WCF服务库调用第三方web服务。从测试应用程序调用第三方web服务时,没有问题,但从WCF服务调用时,出现错误: 接收对xxx.svc/ws的HTTP响应时出错。 这可能是 我已使用添加服务参考添加了第三方web服务。该web服务的绑定自动生成为: <wsHttpBinding> <binding name="WSHttpBinding_xxxService" closeTimeout="00:01:00" openTimeout="
添加服务参考
添加了第三方web服务。该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服务的绑定在testapp.config
文件中自动生成,但第三方服务的绑定仅在WCF appl config中生成
我做错了什么 我找到了解决办法。问题是web应用程序没有使用web配置文件中配置的web服务配置。它总是通过代理直接调用。所以我从代码中调用了web服务,并以编程方式为web服务输入与web配置中相同的设置,并添加了代理地址,它可以通过我的网络 你能告诉我们你用来调用第三方web服务的代码吗?您显示给我们的配置似乎很好-除了我们只看到绑定-没有其他。您没有向我们展示WCF服务内部的客户端端点配置(URL、合同等),在测试程序中,我尝试以相同的方式调用它:xxx_Ws.xxxClient client=new xxxClient();client.Function();跟踪无响应服务的活动可以让您/我们了解没有响应的原因。另外,请确保您没有达到这些配额。打开wcf跟踪以获取更多有关修复的信息恭喜!当你有能力时,请确保将你的答案标记为“已接受”,以便其他人能够从你的成功中学习。干杯~