【发布时间】:2012-11-28 16:31:15
【问题描述】:
我们注意到我们使用 netTcpBinding 的应用程序突然停止工作。在检查了托管服务的服务器上的事件日志后,我发现了以下警告(许多警告之一):
异常信息: 异常类型:超时异常 异常消息:打开操作未在分配的超时时间 00:01:00 内完成。分配给此操作的时间可能 已经是较长超时的一部分。
服务器堆栈跟踪:在 System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(时间跨度 超时)在 System.ServiceModel.Channels.CommunicationObject.Open(时间跨度 超时)在 System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan 超时)
在 System.ServiceModel.Channels.CommunicationObject.Open(时间跨度 超时)在 System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(时间跨度 超时,CallOnceManager 级联)在 System.ServiceModel.Channels.ServiceChannel.EnsureOpened(时间跨度 超时)在 System.ServiceModel.Channels.ServiceChannel.Call(字符串 action, Boolean oneway, ProxyOperationRuntime 操作, Object[] ins, Object[] 出局,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime 操作)在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 留言)
为了解决这个问题,我不得不将 maxReceivedMessageSize 的大小增加 10,所以我的新绑定如下所示:
> <netTcpBinding>
> <binding name="largeBufferNetTcpBinding" listenBacklog="100" maxBufferSize="519730000" maxConnections="100"
> maxReceivedMessageSize="519730000" portSharingEnabled="true">
> <readerQuotas maxArrayLength="519730000"/>
> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
> <security>
> <message clientCredentialType="Windows"/>
> </security>
> </binding>
> <binding name="defaultNetTcpBinding" portSharingEnabled="true"/>
> <binding name="defaultNetTcpMexBinding" portSharingEnabled="true">
> <security mode="None"/>
> </binding> </netTcpBinding>
我不明白 maxReceivedMessageSize 与上面显示的 TimeoutException 有何关系。我可以做些什么来进一步解决这个问题并使服务更可靠?
【问题讨论】:
-
就个人而言,我看不出它们是如何链接的,除非您的网络非常慢。您的代码中有任何可以使用的方法跟踪吗?
-
我们的服务中有跟踪,但它甚至没有到达那里,因为 WCF/.NET 正在引发错误。
标签: wcf wcf-binding nettcpbinding