Reputation: 1007
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.
Upvotes: 3
Views: 190
Reputation: 1007
adkSerenity and shambulator,
Thank you. I found the problem. It turned out to be a buffer size. I was pretty sure it wasn't a timeout because the shortest timeout was set to one minute and I could reproduce the error in thirty seconds.
I had been avoiding WCF Tracing and Message Logging because it was so intimidating. So much to read, so little time. ;-}
When I generated the output at looked at it with the viewer, it might as well have been Martian. After studying it for a while in a fog, I finally get the impression that the loss of communication was not the fault of the service. Then the light bulb went on and I checked the client's config file. Sure enough, the MaxBufferSize was set to 65535, effectively cutting off the 70000 byte message.
Thanks again for pointing me in the right direction.
Upvotes: 4
Reputation: 7067
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,
Upvotes: 2