Geeks With Blogs
Denis Pitcher Denis Pitcher's Tech Blog

I've been delving a fair bit into WCF lately and have been encountering enough gotchas that it is clear that it's time for me to resurrect my tech blog.  My first post: an errant WCF Socket Exception which looks like a timeout due to the message is actually an exception caused by DBNull.



You may have come across the above msg at some point in working with WCF.

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:30'.

Oddly however, none of my binding config settings actually set a timeout of 30 seconds and even more oddly, the message appears almost instantly.

After a tremendous amount of hassle, it was only through some testing that I discovered that a database query in my data access service was returning an unexpected DBNull for a function which when called by my client caused it to abort the socket connection without giving me any details as to why.  On the service side it looked like everything was perfect while the client side blew up with what looked like a timeout.

Moral of the story?  If you get something that looks like a timeout, check the data source first.

Posted on Tuesday, October 7, 2008 11:54 AM | Back to top

Comments on this post: WCF Socket Connection aborted due to DBNull

# re: WCF Socket Connection aborted due to DBNull
Requesting Gravatar...

looks like i got the same error; however my data access layer retrieves data correctly;
but I know that the data returned is large; How Large? well, I only have 3 entity returned;
1 Master and 2 details;

Should I get the same error as you did? The server returned the data but somehow the client didnt received it.
I thought it was the port sharing.. but I set the portsharing=true;

Somehow the communication of the client and server didnt quite go well.

Do you still have any ideas?
Left by Gio on Dec 10, 2008 10:20 PM

Your comment:
 (will show your gravatar)

Copyright © Denis Pitcher | Powered by: