Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoking a method AFTER a wcf service operation has returned its result

Tags:

wcf

I have a WCF service operation and I want a call to the operation to start a long running method, however I want the operation to return its result BEFORE the long running method finishes.

I have tried using an IParameterInspector implementation, but the result of the operation is not returned to the client until the long running method has completed.

How should I go about achieving this as anything I start from the operation seems to have to finish before the result is returned to the client?

Thanks.

like image 917
JPJY Avatar asked May 19 '11 13:05

JPJY


1 Answers

If you want to do it at the server, take a look at http://blogs.msdn.com/b/carlosfigueira/archive/2011/05/17/wcf-extensibility-ioperationinvoker.aspx, it shows how to bypass the operation (it's a caching scenario, but it can be adapted to your problem).

If you want to do it at the client, you can simply call the operation asynchronously, it will return right away. And when the long-running operation completes, you'll get a notification (callback or event) that its results are ready.

like image 95
carlosfigueira Avatar answered Jan 02 '23 10:01

carlosfigueira