Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Handle WCF Client Disconnect

Tags:

c#

wcf

How can I handle WCF Client Disconnects ?

I Tried CallBacks but it seems to only works when Client Disconnect "clearly" by using a "Disconnect" button for example.

I want my server to be notified when Client got disconnected, even on manual disconnect or client process crash.

like image 440
Yoann. B Avatar asked Mar 20 '09 09:03

Yoann. B


1 Answers

Use the OperationContext.Current.Channel.Faulted and OperationContext.Current.Channel.Closed events.

These events are fired when the client has disconnected for whatever reason.

like image 199
Matt Norrie Avatar answered Oct 31 '22 03:10

Matt Norrie