【发布时间】:2010-12-07 13:13:42
【问题描述】:
我使用 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[] 缓冲区,Int32 偏移量,Int32 大小, 布尔立即数,TimeSpan 超时) 堆栈跟踪内部扩展的顶部: System.Net.Sockets.Socket.Send(字节 [] 缓冲区,Int32 偏移量,Int32 大小, SocketFlags socketFlags)
栈顶内部异常:
System.Net.Sockets.Socket.Send(字节[] 缓冲区,Int32 偏移量,Int32 大小, SocketFlags socketFlags)
如果我将有效负载设置为 null(不发送 3.2 MB 对象),则消息会顺利通过。
对象来自另一个服务的事实与我的问题有什么关系吗?在我看来,问题在于消息的大小,但到目前为止,增加配置中的任何选项对我没有帮助。
我尝试在客户端上设置,但没有成功。 使用流式传输会导致切换到请求/响应或删除所有回调...
有什么想法吗?
【问题讨论】:
-
1) 发布您的 maxReceivedMessageSize 和 readerQuota 2) 有效负载进展如何?字节数组?
-
1) maxReceivedMessageSize 去哪儿了?读者 queotas 已经发布了!? 2)有效载荷是一个字节[]
-
尝试增加您的发送超时时间。
-
您的服务是否托管在 IIS 上? IIS 7.5 版?
-
我在 VS 2010 中运行客户端,该服务是自托管的 Windows 服务。
标签: wcf nettcpbinding duplex large-data