【发布时间】:2010-11-15 12:27:15
【问题描述】:
我有一个托管在 IIS7 中的 WCF 服务(服务和客户端配置在本文末尾)。我遇到了一个奇怪的场景,我希望有人可能对如何攻击它并找到解决方案有一些想法。
该服务仅公开一个合同,“ProcessMessage”。我可以使用该合约发送/接收来自服务的同步消息,性能良好,但对该合约的一次特定调用会返回超过 65KB 的数据;大约 1 MB。在最初调用它时,我收到了预期的最大接收大小超出错误。所以我增加了 maxReceivedMessageSize,现在这个特殊的调用需要 40 分钟才能返回到客户端。这远远超出了任何超时设置,也远远超出了我的预期。服务器端处理时间仅为 2 秒。它似乎被客户端搁置了。
我还尝试提高文件中的其他几个配额,但无济于事。
任何想法将不胜感激。谢谢。
服务配置:
<system.serviceModel>
<services>
<service behaviorConfiguration="Lrs.Esf.Facade.Startup.FacadeBehavior"
name="Lrs.Esf.Facade.Startup.FacadeService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="default" contract="Lrs.Esf.Facade.Startup.IFacadeService">
<identity>
<servicePrincipalName value="lrsdomain/PensionDev" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="default">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Lrs.Esf.Facade.Startup.FacadeBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
客户端配置:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IFacadeService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:1:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="52428800" maxReceivedMessageSize="6553600"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://esf2.facade.testpe.pg.local/FacadeWcf/FacadeService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFacadeService"
contract="FacadeServiceReference.IFacadeService" name="WSHttpBinding_IFacadeService">
<identity>
<servicePrincipalName value="lrsdomain/PensionDev" />
</identity>
</endpoint>
</client>
【问题讨论】:
-
我已经运行了 Fiddler 并对客户端进程进行了完整跟踪,并获得了更多信息。响应消息会在几秒钟后返回到客户端计算机(提琴手),但消息日志跟踪和“通过通道接收消息”直到 40 分钟后才会被记录。我的猜测是反序列化消息需要 40 分钟。
-
我将服务主机从 IIS 中取出并创建了一个 TCP 端点,来自客户端 PC 的调用现在在 5 秒内返回。我现在的假设是 wsHTTP 中存在错误,或者 wsHTTP 或 IIS 中的设置我丢失了。
-
我启用了 WAS/TCP 并向 IIS 托管服务添加了一个 TCP 端点。通过 TCP 调用只需要几秒钟,但通过 HTTP(basic 或 ws)调用仍然需要 40 分钟。
标签: wcf timeout wcf-binding