how to stop/cancel a workflow (3.5)
We have implemented several workflows as WCF services, exposing methods that are implemented using ReceiveActivities in our Sequential Workflows. These typically perform long running tasks that are database intensive. Our workflow runtime is hosted in the web.config of the WCF service.
< workflowRuntime name = "WorkflowServiceHostRuntime " validateOnCreate = "true " enablePerformanceCounters = "true ">
< commonParameters >
< add name = "ConnectionString " value = "our connection string" />
</ commonParameters >
< services >
< add type = "System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " connectionString = "our connection string " LoadIntervalSeconds = "1 " UnLoadOnIdle = "true " />
< add type = "System.Workflow.Runtime.Tracking.SqlTrackingService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " IsTransactional = "false " UseDefaultProfile = "true " connectionString = "our connection string " />
< add type = "System.Workflow.Runtime.Hosting.SharedConnectionWorkflowCommitWorkBatchService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " />
</ services >
</ workflowRuntime >
We need to find a way to cancel a workflow instance mid-process that would stop the instance completely. It is necessary for the solution to keep a record of the cancel action in the UserEvents table in the SqlPersistence database.
Does anyone knows how would we cancel/stop a workflow here? Any help appreciated.
- Moved byAmyMacMSFTWednesday, November 04, 2009 11:20 PMWrong Forum for Version (From:.NET Framework 4: Workflow Foundation - Beta 2)
All Replies
- By UserEvents are you referring to custom tracking events? If so, I think the best way to model this would be within the workflow. For example, in a parallel branch with the long running processing you could have a Receive followed by logic that tracked the custom record and then canceled the rest of the workflow.
Sorry to be vague, but I'm a bit fuzzy on my 3.5 workflow services. I'm going to move your post to our Workflow 3.x forum as you'll get more traction there.
-AmyYou need to get access to the WF Runtime: http://social.msdn.microsoft.com/Forums/en-US/windowsworkflowfoundation/thread/c3faff5e-3cb1-4a61-a46c-8eb7c146294d
and then call cancel on the instance in question: http://msdn.microsoft.com/en-us/library/dd454597(VS.100).aspx
If my response answers your question, please mark it as the "Answer" by clicking that button above my post.
My blog: http://www.RyanVice.net/


