I am implementing a WCF service, with a Silverlight 3 client, which uses a PollingDuplexHttpBinding for communications. What are the alternatives for handling when a client closes their browser witho开发者_StackOverflowut disconnecting from the server first?
I know that it will eventually throw a TimeoutException, which I can catch, but is there a better way of detecting this?
Thanks.
You'll want something like this:
OperationContext.Current.Channel.Closed += new EventHandler(Channel_Closed);
The channel also exposes a Faulted event, but the Closed event is thrown immediately afterwards.
精彩评论