【发布时间】:2009-09-08 23:17:43
【问题描述】:
全部,
我有一个 WCF 服务间歇性超时,通常是在来自 asp.net 客户端的大约十到十二个请求之后。该服务使用反射在其程序集 (WAP dll) 中查找具有自定义属性集的类。这个过程本身非常快,通常只需要几毫秒,当它工作时,效果很好。
在调用代码和服务本身中设置断点告诉我在从 WCF 客户端代理类调用和实际执行该方法之间发生超时。
想法?
更新:来自 web.config 的绑定等:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="Sdd.Services.ControlPanelBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="Sdd.Services.ControlPanelBehavior"
name="Sdd.Services.ControlPanel">
<endpoint address="" binding="wsHttpBinding" contract="Sdd.Services.IControlPanel">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
更新:这是客户端 web.config 中的相关部分:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IControlPanel" 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="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:81/services/ControlPanel.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IControlPanel"
contract="PublicSite.IControlPanel" name="WSHttpBinding_IControlPanel">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
【问题讨论】:
-
您有更多信息吗?您使用的是什么类型的配置(绑定、客户端和服务器的位置、不同的超时设置是什么)。当您增加超时时会发生什么?
-
客户端和服务器都在我的开发盒上,在 UltiDev Cassini 下运行。当它工作时,响应时间低于 50 毫秒。这是一致的,直到它突然不起作用,几分钟后超时。我不确定绑定是什么——我在 VS2008 中采用了右键单击、添加... WCF 服务的幼稚方法。如果您能指出我在哪里可以找到该信息,我将很乐意向您报告。谢谢!
-
我知道它正在攻击症状,但请检查您的绑定超时设置。有关说明,请参阅msdn.microsoft.com/en-us/library/ms731291.aspx。
-
如果不清楚:客户端和服务器是同一服务器上的两个单独的 Web 应用程序项目。
-
David,绑定信息应该已经写入服务的 app.config 文件了。