3

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 without 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.

Sako73
  • 9,141
  • 11
  • 53
  • 74

1 Answers1

1

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.

Ken Smith
  • 19,697
  • 13
  • 93
  • 139