wcf 双工大消息对使用 ReliableSessions 的大消息没有给出有意义的回复
我正在使用 NetTCP 双工绑定将文档作为 byte[] 从服务器发送到客户端。 当这个 byte[] 相当大(比如说 10Meg)时,服务器会通过给出
The server did not Provide a Meaning Reply; 来退出;这可能是由合同不匹配、会话过早关闭或内部服务器错误引起的。
较小的消息(例如 1 mb)效果很好。 中的绑定
<bindings>
<netTcpBinding>
<binding name="InsecureTcp" receiveTimeout="0:10:00" sendTimeout="0:05:00" portSharingEnabled="true" openTimeout="0:0:02" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
<security mode="None"/>
<reliableSession enabled="true" ordered="true" inactivityTimeout="0:00:05"/>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
这是我的 web.config 更新 1 看起来可靠会话通过怀疑不活动来终止连接。将文档推送到客户端需要超过 5 秒,因此(我认为)客户端出现了通道故障。 但是:我的 inactivityTimeout 为 5 秒,以便在连接断开时几乎立即收到通知,以便我可以实例化到服务器的新连接。
看起来这两个要求互相矛盾
I am using a NetTCP duplex binding to send a document from the server to the client as byte[].
When this byte[] is pretty large (say 10Meg) the server quits by giving
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
Smaller messages for example 1 mb does work well.
This is the binding in my web.config
<bindings>
<netTcpBinding>
<binding name="InsecureTcp" receiveTimeout="0:10:00" sendTimeout="0:05:00" portSharingEnabled="true" openTimeout="0:0:02" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
<security mode="None"/>
<reliableSession enabled="true" ordered="true" inactivityTimeout="0:00:05"/>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
Update 1
It looks like that the Reliable Session kills the connection by suspecting inactivity. The push of the document to the client takes more than 5 seconds, so the channel is faulted by (I suppose) the client.
However: I have this inactivityTimeout of 5 seconds, to get almost immediately notified when the connection drops, so I can instantiate a new connection to the server.
It looks like these two requirements fight each other
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论