开发者

How to handle client disconnect with PollingDuplexHttpBinding

开发者 https://www.devze.com 2023-01-02 17:34 出处:网络
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开

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消