【发布时间】:2011-12-06 12:47:46
【问题描述】:
也许你们中的任何人都可以帮助我解决这个烦人的问题。我有长期运行的工作流程,由长期运行的应用程序使用。
我使用 SqlWorkflowInstanceStore 进行持久化。
我设置了 DefaultInstanceOwner,以便在应用程序的另一次启动时重新加载工作流。
InstanceHandle handle = workflowInstanceStore.CreateInstanceHandle();
InstanceView view = workflowInstanceStore.Execute(handle,
new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));
handle.Free();
workflowInstanceStore.DefaultInstanceOwner = view.InstanceOwner;
我在应用退出时将其删除:
var deleteOwnerCmd = new DeleteWorkflowOwnerCommand();
InstanceHandle handle = workflowInstanceStore.CreateInstanceHandle();
workflowInstanceStore.Execute(handle, deleteOwnerCmd, TimeSpan.FromSeconds(30));
handle.Free();
在正常的应用使用情况下一切正常。如果 Windows 进入睡眠模式,则会出现此问题。当它从睡眠模式返回时,workflowInstanceStore 的任何其他操作都会抛出:
System.Runtime.DurableInstancing.InstanceOwnerException: The execution of an InstancePersistenceCommand was interrupted because the instance owner registration for owner ID 'GUID' has become invalid. This error indicates that the in-memory copy of all instances locked by this owner have become stale and should be discarded, along with the InstanceHandles. Typically, this error is best handled by restarting the host.
我在 LockOwnersTable 中查看了数据库,系统唤醒时锁定过期设置为 2000-01-01 00:00:00.000。
欢迎您提出任何能找到此行为的根本原因或解决方法的想法。我已经采取了第一个解决方法,即禁用睡眠模式...
【问题讨论】:
-
非常有趣 - 如果我能重现这个我想提交一个错误。你有一个简单的复制品我可以看看吗?
-
这里有同样的问题。您找到其他解决方案了吗?
-
解决办法确实是在WorkflowInstanceOwner失效时检查系统恢复。
标签: windows workflow-foundation workflow-foundation-4