Question

Im using WCF for sending all sorts of messages and this message in perticular is about 3200000 bytes plus some strings and headers. The large paylode is a serialized object retrieved from the host through another service whos configuration I have tried to mimic in every aspect.

Im using netTcp binding for performance and we are using lots of callbacks. I have set all options I can find to the maximum level on both client and server side.

<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>

I get this non-descript error message on the client:

The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9979996'.

And inner exteption:

An existing connection was forcibly closed by the remote host

Running trace brings a bit more information (top of stack trace):

System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout) Top of stack trace inner exteption: System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)

Top of stack trace inner exception:

System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)

If I set the payload to null (not sending the 3.2 MB object) the message goes through without any fuss.

Can the fact that the object originates from another service has anything to with my problem? In my eyes the problem is the size of the message but increasing any options in the configuration has not helped me so far.

I have tried to set on the client with no luck. Using streaming results in switching to request/respons or removing all callbacks...

Any ideas?

Was it helpful?

Solution

I was wrong!! The changes I made on the configuration levels on the host side was on a completely different service. Maximizing the buffer sizes and message sizes did the trick! Im not really sure which one is the one that made it work. I can only recommend all of you that have similar problems to look at MaxBufferSize, MaxReceivedMessageSize, ReaderQuotas->MaxArrayLength and some time out settings both on host and client side. Also to maximize the maxItemsInObjectGraph in the service behavior on the host side.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top