Rush Frisby
Rush Frisby

Reputation: 11454

Duplex WCF service over net.tcp failing

I have a duplex WCF service that I am connecting to over net.tcp. When the service first starts up I am able to call it and receive callbacks just fine and but after a few minutes I start getting this error from the service:

A TCP error (995: The I/O operation has been aborted because of either a thread exit or an application request) occurred while transmitting data.

I've tried hosting the service in IIS as well as a windows service but I get the same error in both. In my trace log I see that there is a SocketConnection aborted warning just before the exception.

What is causing this?

The method I am using for keeping track of subscribers of the service I got from here. I can post my config if needed but didn't want to clutter up my question if it's not.

Upvotes: 1

Views: 449

Answers (1)

evgenyl
evgenyl

Reputation: 8107

There are 2 aspects:

  1. Why exception occurred

may be this post can help (in short - in his situation Antivirus was responsible for error)

  1. What happens with connection and client's callback - exception, not wrapped by Fault will "kill" the connection, and your client will not be able to re-use it, it'll receive "aborted" error.

You need to subscribe on the client side for failed calls, and re-init your connection.

Like

((IClientChannel)YourClient).Faulted += InnerChannel_Faulted;
}


void InnerChannel_Faulted(object sender, EventArgs e)
{

    TWLogger.Write("Faulted event ... ");
    reconnect();
} 

Also, I'd recommend to wrap all server-side exceptions with Fault

Upvotes: 1

Related Questions