Search code examples
workflow-foundation-4state-machine

Resuming a suspended state machine workflow instance in Windows Workflow Foundation 4


I currently have a State Machine running as a Windows Workflow Foundation 4 Web Service. This solution is for long running workflows so it also utilizes the SqlWorkflowInstanceStore. The problem I have is that I can’t find a solution to Resuming a Suspended workflow instance. The examples I’ve seen online don’t seem to apply for a State Machine. The confusion seems to come from the fact that I don’t have an endpoint to reference which is needed to create the proper WorflowControlClient object.

Any help would be appreciated.


Solution

  • I created a web.config file in the same subdirectory of my service. Then for each Receive action I had to define an endpoint in the newly created web.config. I was then able to add an additional endpoint definition as a workflowControlEndpoint.

    <endpoint address="wce" binding="basicHttpBinding" name="wceEndpoint" kind="workflowControlEndpoint"/>
    <endpoint address="" binding="basicHttpBinding" name="WorkFlowCreated" contract="IWorkFlowCreated" />
    <endpoint address="" binding="basicHttpBinding" name="WorkFlowUpdated" contract="IWorkFlowUpdated" />
    

    Then it became possible to create the WorkflowControlClient

    WorkflowControlClient controlClient = new WorkflowControlClient(
      new BasicHttpBinding(), 
      new EndpointAddress(new Uri("http://sitepath/general/1.0.0/General.xamlx/wce")));
    controlClient.Unsuspend(instanceId);</code>