Executing one workflow from another synchronously

The InvokeWorkflow activity which comes with Workflow Foundation (.NET 3.0) executes a workflow asynchronously. So, if you are calling a workflow from ASP.NET which in turn calls another workflow, the second workflow is going to be terminated prematurely instead of executing completely. The reason is, ManualWorkflowSchedulerService will execute the first workflow synchronously and then finish the workflow execution and close down. If you used InvokeWorkflow activity in order to run another workflow from the first workflow, it will start on another thread and it will not get enough time to execute completely before the parent workflow ends.

Here you see only one activity in the second workflow gets the chance to execute. The remaining two activities do not get called at all.

Luckily I found an implementation of synchronous workflow execution at:


It's an activity which takes the workflow as input and executes it synchronously. The implementation is very interesting to see. Please see the original blog post for details.

Published Wed, Dec 27 2006 15:38 by omar
Filed under: