Accessing WorkflowApplication by ID
-
lunedì 12 marzo 2012 13:47
I don't have any experience with WF, but a lot of experience in .NET back end/front end overall.
.NET 4 / C# project.
What I am trying to achieve:
1. A simple Workflow which can be started and stopped through a service.
So far I have a public method "Start" and a public method:
MyWorkflow wf = new MyWorkflow (); public void StartService() { _wfApp = new WorkflowApplication(wf); _wfApp.SynchronizationContext = SynchronizationContext.Current; _wfApp.Run(); }What needs to be done is that I persist my _wfApp.Id and then be able to stop this particular instance from my public void Stop() method. I did read on persisting workflows etc, but I am having a hard time finding a simple example where I would be able to get my workflow by an Id. There should be some sort of a collection of currently running worlflows. I did find something for .NET 3.5, but not for 4.0 .
Basically the QUESTION is: How do I "find" and access a particular workflow application using its ID ?
Thanks,
Tutte le risposte
-
lunedì 12 marzo 2012 15:25
you can use "_wfApp.Id" to get the id of your current WorkflowApplication and after that you can load that instance to terminate it.- Proposto come risposta Arvand Fazeli martedì 13 marzo 2012 10:29
- Contrassegnato come risposta LeoTangModerator lunedì 19 marzo 2012 07:51
-
mercoledì 14 marzo 2012 07:47Moderatore
Hi,
If you want to get the instance id of a running workflow, it requires writing code, you can refer to the following sample:
Get WorkflowInstanceId
http://msdn.microsoft.com/en-us/library/ee943758.aspx
In addition, we can control the remote workflow service instance by using workflow control endpoint.
Leo Tang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

