Search code examples
c#.netwcfnettcpbinding

netTCPBinding configuration cannot transport small sized data - socket connetion was aborted


I have a WCF service hosted by a Windows Service. It has a Publish/Subscribe relationship to zero to many clients within the network. The binding is net.TCP. The WCF Service provides a "Subscribe" method to the client so the client can register a callback handler. The WCF Service periodically calls methods in the callback handler of any currently subscribed clients.

The interface is defined (with abreviation) below:

    [OperationContract(IsOneWay = false)]
    void ReturnInitialData(
        InitialData initialData,
        CraneState recentState,
        VerticalCraneState recentVerticalCraneState,
        ThresholdState recentThresholdState,
        StationaryStatusFlagsState recentStationaryStatusFlagState,
        LightsState recentLights,
        BarrierRiskState recentBarrierRiskState
        );

When the service calls ReturnInitialData() with approximately 42000 bytes of data, it works fine. When the service calls it with approximately 70000 bytes of data it throws the following exception:

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:10:00'.

This is the netTcpBinding configuration:

General
CloseTimeout                00:00:20
HostNameComparisonMode      StrongWildcard
ListenBacklog               0
MaxBufferPoolSize           524288
MaxBufferSize               2147483647
MaxConnections              0
MaxReceivedMessageSize      2147483647
OpenTimeout                 00:01:00
PortSharingEnabled          False
ReceiveTimeout              00:10:00
SendTimeout                 00:10:00
TransactionFlow             False
TransactionProtocol         Ole Transactions
TransferMode                Buffered


ReaderQuotas Properties
MaxArrayLength              0
MaxBytesPerRead             0
MaxDepth                    0
MaxNameTableCharCount       0
MaxStringContentLength      0


ReliableSession Properties
Enabled                     False
InactivityTimeout           00:10:00
Ordered                     True

Any leads or pointers are welcome.


Solution

  • You may want to enable WCF Tracing and Message Logging, which will allow you to monitor/review communication to/from the WCF service and hopefully isolate the issue (which, based on the provided error message, may likely be a timeout issue.)

    The following links provide a good overview:
    http://msdn.microsoft.com/en-us/library/ms733025.aspx

    Regards,