views:

726

answers:

2

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.

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

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

+2  A: 

A long running task should really be farmed off as an asynchronous call, that could then be polled for status (or an event through a duplex connection). For a really long running task, you might even want to push it into something like Windows Workflow.

Steve Gilham
+1  A: 

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.

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:

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.

Some links for the new stuff:

Marc

marc_s