Search code examples
workflow-foundation-4workflowservice

How to programmatically terminate a workflow instance running as a workflow service


I am using windows workflow service and would like to programmatically terminate a specific workflow instance via a web service request without building this into the workflow itself.

By building it into the workflow itself, I mean having a specific Receive activity which will be responsible for terminating the activity.

So I am imagining something like:

http://myhost/myworkflowservice/myworkflow.xamlx/terminate

Does this type of functionality exist?

Thanks, Eric


Solution

  • Just add a Workflow Control Endpoint which allows one to call remote operations on workflow service. Add it through web.config:

    <endpoint address="<endpoint_address>" binding="basicHttpBinding" kind="workflowControlEndpoint" />
    

    Then you can use WorkflowControlClient to call control messages (Run, Cancel, Suspend, etc.) to a WorkflowControlEndpoint.