本文介绍了在 WCF 中处理运行时间较长的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我目前正在开发的应用程序中,我们使用了多种 WCF 服务和多种方法.到目前为止,所有方法都运行时间很短,通常只是获取一些数据.我刚刚添加了一个需要更长运行时间的方法.

In the app I'm currently working on we are using a couple of WCF services with a lot of methods. Until now, all methods are very short running, often just getting some data. I've just added a method that takes a way longer time to run.

我不想在配置中提高超时时间,因为 1 分钟对于服务上的所有其他方法来说已经足够了.

I do not want to raise the timeout in the config, because 1 minute is long enough for all other methods on the service.

处理 1 个运行时间较长的方法的最佳方法是什么?我如何提供它仍在运行的反馈?

What is the best way to deal with 1 longer running method? And how do I provide feedback that it is still running?

推荐答案

将 WCF 与 WF(工作流基础)相结合似乎是这里的最佳选择.Workflow Foundation 为您提供了许多好处,包括在您长期运行的流程的整个生命周期中的长期持久性.

Combining WCF with WF (Workflow Foundation) seems like the best option here. Workflow Foundation gives you lots of goodies, including long-term persistence over the lifetime of your long-running process.

在 .NET 3.5 中,可以这样做,但很笨拙,而且工作量很大.

In .NET 3.5, it's possible to do so, but clumsy and a lot of work.

以下是该主题的一些链接:

Here are a few links for this topic:

在 .NET 4.0 中,这些WorkflowServices"将成为新的 WF/WCF 4.0 包的重要组成部分.您基本上应该能够将任何工作流的接口公开为 WCF 服务.听起来很有前途,还没有机会自己尝试.

With .NET 4.0, these "WorkflowServices" will be a big part of the new WF/WCF 4.0 package. You should basically be able to expose an interface for any workflow as a WCF service. Sounds very promising, haven't had a chance to try it myself.

一些新内容的链接:

马克

这篇关于在 WCF 中处理运行时间较长的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 05:12