我在worflow基础4中运行工作流,使用SQL Durable实例进行持久化。
有时,我在恢复工作流程时会收到System.Runtime.DurableInstancing.InstanceOwnerException。
System.Runtime.DurableInstancing.InstanceOwnerException occurred
Message="The execution of an InstancePersistenceCommand was interrupted because the instance owner registration for owner ID 'd2db07fd-f31d-458c-be53-de163d5db8d4' 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."
Source=System.Runtime.DurableInstancing
StackTrace:
à System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
à System.Runtime.DurableInstancing.InstancePersistenceContext.ExecuteAsyncResult.End(IAsyncResult result)
à System.Runtime.DurableInstancing.InstancePersistenceContext.OuterExecute(InstanceHandle initialInstanceHandle, InstancePersistenceCommand command, Transaction transaction, TimeSpan timeout)
à System.Runtime.DurableInstancing.InstanceStore.Execute(InstanceHandle handle, InstancePersistenceCommand command, TimeSpan timeout)
à System.Activities.WorkflowApplication.PersistenceManager.Load(TimeSpan timeout)
à System.Activities.WorkflowApplication.LoadCore(TimeSpan timeout, Boolean loadAny)
à System.Activities.WorkflowApplication.Load(Guid instanceId, TimeSpan timeout)
à System.Activities.WorkflowApplication.Load(Guid instanceId)
有没有办法避免这种异常?
答案 0 :(得分:1)
这通常是上一次运行未正常完成并在原始锁定到期之前重新启动的结果。这是由于编辑/调试/编辑循环还是在生产环境中发生的?
您可以使用HostLockRenewalPeriod设置调整锁定周期。请记住,将其设置为真正的低值通常不是一个好主意。