views:

633

answers:

1

I'm working with Beta 2 of Visual Studio 2010 to get some advanced understanding of WF4. I've created a workflow that has a Pick Activity that is contained in an If Activity. In the Pick Activity I have two Triggers, one that contains a Delay set with a TimeSpan of 10 seconds, the other Trigger has a Bookmark for a manager to approve. I'm trying to use the Delay to set a "state" variable to "Expired" if the manager doesn't approve in the allotted time. This is very similar to what Matt Milner did in his post at: http://msdn.microsoft.com/en-us/library/ee342461.aspx, except he uses a DoWhile Activity, whereas I need to use the If Activity I've described here. I'm also using persistence and hosting the workflow from an ASP.Net application. I'm wondering if the problem I'm seeing is caused by the internet browser not keeping the workflow running in memory, and there is no way for the workflow to come be re-started when the delay completes.

+1  A: 

If you are using the WorkflowServiceHost, or a XAMLX, to host the workflow you will need to configure the WorkflowManagementService to reload and restart the workflow. If you are using the WorkflowApplication you are responsible for reloading the workflow after it has been persisted.

But as Chris said: a bit more info on what is actually going wrong might be helpful here.

Maurice
I'm using the WorkflowApplication. We have a similar .Net 3.5 workflow that has an "Expired" event handler with a delay of 14 days. When the 14 days has elapsed, the event handler gets called automatically for us and the code in the Expired event handler gets run without us reloading the workflow in a hosting application. Has this changed in the .Net 4.0 workflow when using the Pick activity with bookmarks and delays similarly to an event handler to mimic a state machine workflow?
Russ Clark
WF4 is a completely new code base where pretty much everything has changed. With a WorkflowApplication there is nothing that will reload your workflow once it as been unloaded. You are responsible for doing that part yourself. Its one of the problems with using a WorkflowApplication that has not really been addressed yet.
Maurice
OK, Thanks! Do you know of any good samples or tutorials for using the WorkflowServiceHost? I'm starting to look into using that, but am having a hard time understanding it.
Russ Clark
Start with a workflow service application. The XAMLX file (note the extra X) is hosted in IIS/Casini using the WorkflowServiceHost.
Maurice