Deploying the WCF Full Duplex Client Interface

Is there any way to detect client failure from my service? I only get the opportunity to find out if a particular client is disabled on the try-catch method, which is not a good way to do this. I do not want to create a timer for each new client that connects to my service only to monitor its latest transaction.

+4
source share
1 answer

No, there is no simple or elegant way to detect a client disconnect. It would be nice if the client closed or crashed, the service received a "ClientTerminated" event. However, this behavior is simply not consistent with the message-based architecture.

A not-so-elegant solution is to periodically ping the client using the callback method and see if the call expires.

Alternatively, if you use PerSession instancing, you can set the inactivityTimeout value to a short value (for example, one minute instead of 10 by default), and on the client side use a timer to periodically call an empty method on the server.

See this question for a similar discussion.

+2
source

All Articles