Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 21, 2008 01:38 AM by pure.krome
Nov 13, 2008 11:29 PM|LINK
have you thought about how errors could be handled with your Pipeline. Imagine if there was so unexpected error for some reason. Currently, the pipeline would just terminate nicely. It's simple to handle a WorkflowTerminated event .. but i'm curious to
see how you can intergrate that into your MVC app .. or should i be more specific, your controller action method. Especically when you invoke the workflow instance, it runs off asyncronously .. so if u DO bubble up some errors (eg. UI validation error or logic
error, which you want to then display to the UI) .. the mvc controller action method has already continued on and completed.
Nov 20, 2008 09:33 AM|LINK
I've found the answer to having the WF run asyncronously in ASP.NET.
this link here describes a way, but they are putting the runtime into the Application state, which doesn't apply to the starter kit because the WF is in it's own project.
What needs to be added to the runtime is a manual service. The default one is an async one.
here's some code.
public static WorkflowRuntime WFRuntimeInstance
if (WFRuntime == null)
WFRuntime = new WorkflowRuntime();
ManualWorkflowSchedulerService manualScheduler =
if (manualScheduler == null)
throw new InvalidOperationException("Unable to retrieve the manual workflow scheduler service.");
WorkflowInstance instance = WFRuntimeInstance.CreateWorkflow(typeof(AddPostWorkflow),
instance.WorkflowRuntime.WorkflowTerminated += WorkflowRuntime_WorkflowTerminated;
Notice how on the creation of the static object, we add the Manual service. Then, when we start the workflow, we also run the manual scheduler's workflow.
Now .. to figure out how to capture any exceptions that were thrown in the WF, and bubble them back up to the controller ... *hint hint* :)
Nov 21, 2008 01:38 AM|LINK
Please excuse my one person conversation here :) ... but i've figure out how to bubble up exceptions that occur in the workflows, to the controller.
I've uploaded a patch to
a) manual scheduler service
b) handling trapping any exceptions thrown in the workflow.
hth Rob :)