通过 WCF 双工通道长时间运行的回调合约 - 替代设计模式?

发布于 2024-07-13 23:21:15 字数 656 浏览 4 评论 0原文

我有一个 Windows 服务,用于将雷达枪的速度读数记录到数据库中。 另外,我将该服务设为WCF服务器。 我有一个 Forms 和一个 CF 客户端,它们订阅该服务,并在有满足特定条件的读数时得到回调。

原则上这是可行的,但一段时间后通道会超时。 似乎长期运行的连接存在一些基本问题(请参阅 http://blogs.msdn.com /drnick/archive/2007/11/05/custom-transport-retry-logic.aspx)和双工 HTTP 回调可能不是正确的解决方案。 还有其他方法可以使用 WCF 实现发布/订阅模式吗?

编辑:即使有 2 小时的超时,通道最终也会受到损害。 我收到此错误:

操作“SignalSpeedData”无法完成,因为会话通道在等待接收消息时超时。 要增加超时,请在配置文件中的绑定上设置 receiveTimeout 属性,或直接在绑定上设置 ReceiveTimeout 属性。

这发生在最后一次成功呼叫后 15 分钟。 我想知道是否可以为每个呼叫重新建立一个新的会话,而不是保持会话打开。

I have a Windows service that logs speed readings from a radar gun to a database. In addition, I made the service a WCF server. I have a Forms and a CF client that subscribe to the service and get called back whenever there is a reading that satisfies certain criteria.

This works in principle, but after some time the channel times out. It seems that there are some fundamental issues with long-running connections (see
http://blogs.msdn.com/drnick/archive/2007/11/05/custom-transport-retry-logic.aspx) and a duplex HTTP callback may not be the right solution. Are there any other ways I can realize a publish/subscribe pattern with WCF?

Edit: Even with a 2 hour timeout the channel is eventually compromised. I get this error:

The operation 'SignalSpeedData' could not be completed because the sessionful channel timed out waiting to receive a message. To increase the timeout, either set the receiveTimeout property on the binding in your configuration file, or set the ReceiveTimeout property on the Binding directly.

This happened 15 minutes after the last successful call. I am wondering if instead of keeping the session open, it is possible to re-establish a fresh session for every call.

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

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

发布评论

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

评论(1

夏末染殇 2024-07-20 23:21:15

可靠的消息传递将满足您的需求。 如果出现问题,通道会自行重建。 WSDualHTTPBinding 为 http 绑定提供了此功能,并且还有一个 tcp 绑定允许此操作。 如果您在同一台计算机上,命名管道绑定将默认提供此功能。

Reliable messaging will take care of your needs. The channel reestablishes itself if there is a problem. WSDualHTTPBinding provides this for the http binding, and there is also a tcp binding that allows this. If you are on the same computer, named pipe binding will provide this by default.

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