如何检测服务中客户端回调通道故障
我正在通过 wsDualHttpBinding 使用双工通信。
每个登录服务器的客户端,都会构造一个GUID和一个回调通道,并保存在字典中。 (一种非常标准的方法)
我需要一种方法让服务检测客户端何时意外关闭。我尝试在服务器端为错误处理程序挂钩一个函数,但它从未被调用。
我猜测是因为连接在服务器端处于半打开状态,因为它在 wsDualtHttpBinding 中使用不同的回调通道和客户端通道。
有什么建议吗?
I am using a duplex communication over wsDualHttpBinding.
Each client that logs in to the server, a GUID and a callback channel are constructed and saved in a dictionary. ( A very standard approach )
I need a way for the service to detect when a client has shut down unexpectedly. I have tried hooking a function for the faulted handler at the server side, but it is never called.
I am guessing because the connection is half open on the server side since it uses different channels for the callback and the client channel in wsDualtHttpBinding.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你不会找到解决方案。如果您不需要 WS* 兼容性,您可以想象创建一个自定义绑定和通道,在客户端和客户端之间发送心跳数据包。定期服务器,类似于 HTTP 长轮询。当错过一定数量的心跳(例如 2 个)时,假设另一端已断开连接。否则,服务器无法知道客户端已意外断开连接,直到超时。
I don't think you're going to get a solution to this. If you didn't need WS* compatibility, you could conceivably create a custom binding and channel that sent heartbeat packets between client & server periodically, similar to HTTP Long polling. When some number of heartbeats (say 2) is missed, assume the other end has disconnected. Otherwise, there's no way for the server to know the client has disconnected unexpectedly, until it times out.