我使用 WCF 发送各种消息,并且这条消息特别是大约 3200000 字节加上一些字符串和标题。大paylode是通过另一个服务从主机检索的序列化对象,我试图在各个方面模仿其配置。
我使用 netTcp 绑定来提高性能,我们使用了很多回调。我已将客户端和服务器端的所有选项都设置为最高级别。
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IEventMissionService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None" />
</binding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:7359/EventMissionMap" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IEventMissionService" contract="RXEventMissionMapService.IEventMissionService" name="NetTcpBinding_IEventMissionService" />
</client>
</system.serviceModel>
我在客户端收到此非描述性错误消息:
套接字连接被中止。这可能是由于处理您的消息时出错或远程主机超出接收超时,或者是潜在的网络资源问题造成的。本地套接字超时为“00:00:59.9979996”。
和内部扩展:
现有连接被远程主机强行关闭
运行跟踪会带来更多信息(堆栈跟踪顶部):
System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout) 堆栈跟踪内部扩展顶部:System.Net.Sockets.Socket.Send(Byte[] buffer, Int32偏移量,Int32 大小,SocketFlags socketFlags)
堆栈跟踪内部异常的顶部:
System.Net.Sockets.Socket.Send(Byte[] 缓冲区,Int32 偏移量,Int32 大小,SocketFlags socketFlags)
如果我将有效负载设置为 null(不发送 3.2 MB 对象),则消息会毫不费力地通过。
对象来自另一个服务的事实与我的问题有什么关系吗?在我看来,问题在于消息的大小,但到目前为止,增加配置中的任何选项对我没有帮助。
我试图在没有运气的情况下设置客户端。使用流式传输会导致切换到请求/响应或删除所有回调......
有任何想法吗?