I have a workflow executed from an .aspx page. The workflow looks like this:
- handleExternalEventActivity1
- callExternalMethodActivity1
- codeActivity1 (never invoked)
- handleExternalEventActivity2
I would expect the first three activities to be executed, before the workflow instance become idle on the fourth activity (eventSink). However, the callMethod activity is triggered and it invokes the service method as expected, but then it halts, and does note execute the code activity.
My Inderface have one event and one method, and looks like this:
[ExternalDataExchangeAttribute()]
interface IPageFlow
{
event EventHandler<WorkflowEventArgs1> SubmitPage;
void PageMessageProcessed(WorkflowMessage1 newWorkflowMessage1);
}
Both EventSinks are listening on the SubmitPage Event, while the callMethod activity invokes the pageMessageProcessed method.
After starting the workflow(from ASP.Net), and raising the SubmitPageEvent, the first eventsink activity is triggered and also the callMethod activity. but NOT the code activity.
void
StartWorkflow(string xmlMessage){
WorkflowRuntime wr = WorkflowRuntimeHost.Runtime;
WorkflowInstance wi = wr.CreateWorkflow(typeof(PageFlowWorkflowLibrary.Workflow1));
wi.Start();
ManualWorkflowSchedulerService ss = wr.GetService<ManualWorkflowSchedulerService>();
PageFlowService pageFlowService = wr.GetService<PageFlowService>();
WorkflowMessage1 msg = new WorkflowMessage1();
pageFlowService.RaiseSubmittPageEvent(msg);
ss.RunWorkflow(wi.InstanceId);
}
Executing the workflow from a Console application, without the ManualWorkflowScheduler works fine.
Thanks
Mikael
Workflow becomes idle after CallExternalMethodActivity.
Ali AYEN
derhackler
Alnilam
I've tried execute the RunWorkflow method from the service when the PageMessageProcessed method is invoked from the CallExternalMethod activity, but it still does not execute the code activity. I read somewhere that you could schedule the ManualWorkflowSchedulerService to execute the RunWorkflow, but that does not seem like the right way...
Mikael
Howard van Rooijen
Are you sure there isn't an exception being thrown
lenyado
Marnik Van Hileghem
I figured out what was going on in the project, and thought I'd put it in the forum for other people to see.
What was happening was this:
A SequentialWorkflow with the following children:
HandleExternalEvent1
CallExternalMethod1
CodeActivity
HandleExternalEvent2
CallExternalMethod2
What was happening is that when CallExternalMethod1 was firing - code inside of the Host was doing a Response.Redirect. Since that ends the thread executing (Response.Redirect throws an exception that is caught by the ASP.NET runtime) - CallExternalMethod1 never finished executing.
So to the WorkflowRuntime - CallExternalMethod1 was still in an executing state - so no matter how many times RunWorkflow was called, the Workflow never moved from CallExternalMethod1.
The fix was easy - just call Response.Redirect(url,false) - passing false to the Response.Redirect overload instructs the Response object to not throw the exception ending the execution of the request. Once false was passed the Workflow and RunWorkflow behaved as expected.
askgy
You'll have to call RunWorkflow again. Each piece of "work" or schedule of work needs to be run with the ManualWorkflowScheduleServer.RunWorkflow.
If you call RunWorklow too many times it is just a no-op (since there will be no activities scheduled to run)
msgm69
No. no exception thrown...
SureshGadiraju
Nigel Batten
Dan Hedges
Pockey