没有传输安全性的 WCF 可靠会话不会按时发生故障事件
我遇到了可靠会话的一个非常有趣的行为。我使用的是netTcp绑定+双工通道+可靠会话。
当我尝试侦听channel.faulted时,如果安全模式设置为transport,则当客户端断开连接时,故障事件将立即触发。
但是,当我将绑定的安全模式设置为“无”或“消息”时,在相同情况下不再触发错误事件。他们最终会在服务器端出现一半的 ReciveTimeout 故障,我理解这是因为可靠的会话当时会发送心跳消息。
问题是:为什么wcf绑定没有按时出现故障?
这种情况的解决方法是我可以手动“ping”连接。
I have encountered a very interesting behavior of reliable session. I am using netTcp binding + duplex channel + reliable session.
When I am trying to listen on channel.faulted , if there is security mode is set to transport , faulted event would fire immediately when client disconnects.
However when I set binding's security mode to None or Message, faulted event no longer fires in the same situation. They will eventually get faulted half of ReciveTimeout on server side which I understands as reliable session would send a heart beat message at that time.
The question is: Why the wcf binding does not get faulted on time?
The workaround for this case is I can manually "ping" connections.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,NetTcp 绑定使用 传输安全性 和 Windows 凭据。默认情况下,除 BasicHttp 和 WebHttp 之外的所有绑定都是安全的。
NetTcp binding by default uses Transport security with Windows credentials. All bindings except BasicHttp and WebHttp are secured by default.