I'm working on a asp.net mvc project that will use MS Windows Workflow Foundation to manage client business work flows. These are long running workflows spanning in time over a year or two. So we've decided to use State Machine workflows. A workflow instance will be persist开发者_Python百科ed to a database when not being used (or in idle).
I'm fairly new to MS WF and would like to find out the best practices for implementing the workflows for an asp.net mvc application.
More specifically, where should I host the WF runtime? In asp.net mvc or in a separate process like Windows Service?
I would be most grateful to hear success stories of how MS WF is implemented in asp.net mvc?
Any comments and ideas are welcome,
Thank you all,
Cullen
Are you referring to WF3 or WF4 which is a completely different piece of code.
With WF3 there is the central WorkflowRuntime and that is usually hosted somewhere at the application or possibly session level.
Updated Some of the things to watch out for:
- IIS can recycle the AppDomain at any time it wants to when there are no incoming calls being processed. An async workflow is NOT considered part of the request as it is running on another thread.
- To migrate workflows from the old to the new AppDomain you need a persistence service.
- The new AppDomain might not be activated right away causing delay activities not to execute as soon as you would expect.
- Its is generally best to use the manual workflow scheduler but that makes writing code somewhat more complex as you have to schedule the work and then start execution.
精彩评论