WCF 应用过程中遇到的问题和解决方法

Posted on 2014-01-16 17:12  Color4days  阅读(122)  评论(0)    收藏  举报

1.WCF超时

   超时不一定就是报 TimeOut, 我的错误信息:

接收对 http://nb1212009:9999/ADHelper 的 HTTP 响应时发生错误。这可能是由于服务终结点绑定未使用 HTTP 协议造成的。这还可能是由于服务器中止了 HTTP 请求上下文(可能由于服务关闭)所致。有关详细信息,请参见服务器日志。

    原因就是超时,而我本来是设置了超时时间的,因为我原来的执行时间在10分钟内,所以没有察觉到设置的超时没有生效.直到method执行时间调整到超过10分钟之后才发现设置未生效.

    期间饶了很多弯路,结果是因为endpoit没有添加bindingconfigration....

    <endpoint address="" contract="Diodes.BPMService.BPMInterface.IADHelper" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IADHelper" />

    所以bindingconfigration是用来读取Binding的超时等相关设置内容的.

<wsHttpBinding>
<binding name="WSHttpBinding_IADHelper" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288000" maxReceivedMessageSize="65536000"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxStringContentLength="20971520" maxArrayLength="20971520"/>
<security mode="None">
</security>
</binding>
</wsHttpBinding>

很小的问题,我找了3天原因...

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3