如何使用 PollingDuplexHttpBinding 处理客户端断开连接

发布于 2024-09-05 04:12:00 字数 184 浏览 2 评论 0原文

我正在使用 Silverlight 3 客户端实现 WCF 服务,该客户端使用 PollingDuplexHttpBinding 进行通信。当客户端关闭浏览器而不先与服务器断开连接时,有哪些替代处理方法?

我知道它最终会抛出一个 TimeoutException,我可以捕获它,但是有没有更好的方法来检测这个问题?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ペ泪落弦音 2024-09-12 04:12:00

您会想要这样的东西:

OperationContext.Current.Channel.Closed += new EventHandler(Channel_Closed);

通道还公开了一个Faulted事件,但随后立即抛出了Closed事件。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文