WCF 服务应用程序保持空闲状态,直到手动点击 .svc 文件

发布于 2024-10-06 16:15:29 字数 205 浏览 0 评论 0原文

我创建了一个在 IIS 7.0 中运行的 WCF 服务应用程序。在它的初始化中,我启动了一个无限循环( while(true) ),但是一段时间后,我没有从他的 svc 文件中调用方法,wcf 进入空闲模式,并且它没有反应循环必须执行的过程。就像它停止工作一样。然后,如果我调用他的 svc 文件的方法,然后再次开始工作。是否有解决方案来避免空闲模式,以便它可以继续保持循环中的过程处于活动状态?

I create a WCF Service Application that runs in IIS 7.0 . In its initialization I start an endless loop ( while(true) ) , but after a period of time ,where I didn't call a method from his svc file, the wcf pass in an idle mode, and it doesn't react in the process the loop has to do. It is like it stops working. And then if i call a method to his svc file then starts working again. Is there a solution to avoid the idle mode so it can continue to keep the procedure in the loop alive?

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

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

发布评论

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

评论(2

蓝眸 2024-10-13 16:15:29

WCF 服务被设计为在发出请求时“唤醒”。

如果您想要连续轮询之类的功能,您可能需要考虑创建 Windows 服务

如果您正在寻找维护状态的 WCF 服务,则必须自己实现。一种方法是部署具有持久性的工作流服务(使用 WF 4),例如 SqlWorkflowInstanceStore。它使用 WCF 公开其接口。服务在调用之间将处于空闲状态,但实例将记住状态。

WCF services are designed to "wake up" when requests are made.

If what you want is something like continuous polling, you may want to consider creating a Windows Service instead.

If you're looking for a WCF service that maintains state, you'll have to implement that yourself. One way is to deploy a Workflow Service (using WF 4) with persistence, such as SqlWorkflowInstanceStore. It exposes its interface using WCF. The service will be idle between calls, but instances will remember state.

遗心遗梦遗幸福 2024-10-13 16:15:29

WCF 旨在被使用并触发事件,而不是托管长时间运行的进程。您确实希望 WF(工作流基础)或 BizTalk 托管一些长时间运行的事件。 WCF 活动通常是短暂的。您可以创建一个结合了这两个概念的 XAMLX。

WCF is meant to be consumed and to fire events, not to host long-running processes. You really want WF (workflow foundation) or BizTalk to host some long-running events. WCF events are typically short lived. You can create a XAMLX which combines the two concepts.

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