Thursday, January 24, 2008

WCF error: The socket connection was aborted.

I got this error when I called my WCF service:

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.9921880'.

One of the things I've noticed with WCF is that some of the error messages are not very helpful.

The actual problem here was that the message was too large and it was exceeding the settings for the binding. I updated my bindings and everything is working fine now. In the MSDN docs, it says these settings are to limit denial of service exposure, so maybe that's why the error message isn't very helpful.

Here are the settings I updated:
  • maxReceivedMessageSize
  • maxBufferSize
  • maxBufferPoolSize

I updated these settings on the client and server.

Warning: I have not done any research into these settings to see exactly what they are. It is quite possible that changing only one of these settings will work and it is also possible that changing these settings may have an adverse impact to your system.

So, here is the section from my new config file:

<binding name="MyCoolBinding" maxreceivedmessagesize="10000000" maxbuffersize="10000000" maxbufferpoolsize="10000000">

Good luck!



No comments: