开发者

How to handle client disconnect with PollingDuplexHttpBinding

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜