R – Terminate unowned workflow

workflowworkflow-foundation

I'm currently using WF with multiple hosts. If one of these hosts owns a workflow, but crashes, I'd like another host to be able to terminate the workflow. Is there any way to do this?

What I've tried so far is to first remove ownership by executing a sql query to set ownerID and ownedUntil to NULL, unlocked to 1, and nextTimer to the current date. Then I get the workflow instance from the runtime and call terminate on it. This only seems to work when the host that starts the workflow is the one that terminates it.

Best Answer

I found a workaround. I call Terminate twice on the workflow instance. I still don't understand why that is needed, but it seems to work.