我们有一个管理文档生命周期的业务逻辑 这是使用Workflow Foundation 4和WF Persistence实现的。 在工作流程执行期间,在工作流程中创建某些书签,并且计划任务会定期查找所有特定书签并恢复工作流程 (正在执行的活动会进行一些处理并再次为工作流程添加书签,以便稍后可以恢复工作流程。)
现在,对于某些正在运行的工作流实例,我们收到以下错误:
System.Runtime.DurableInstancing.InstanceNotReadyException was unhandled Message=The execution of an InstancePersistenceCommand was interrupted because the instance '99ce9413-5b17-4de0-a453-46891509e032' has not yet been persisted to the instance store. Source=System.Runtime.DurableInstancing StackTrace: at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.Runtime.DurableInstancing.InstancePersistenceContext.OuterExecute(InstanceHandle initialInstanceHandle, InstancePersistenceCommand command, Transaction transaction, TimeSpan timeout) at System.Runtime.DurableInstancing.InstanceStore.Execute(InstanceHandle handle, InstancePersistenceCommand command, TimeSpan timeout) at System.Activities.WorkflowApplication.PersistenceManager.Load(TimeSpan timeout) at System.Activities.WorkflowApplication.LoadCore(TimeSpan timeout, Boolean loadAny) at System.Activities.WorkflowApplication.Load(Guid instanceId, TimeSpan timeout) at System.Activities.WorkflowApplication.Load(Guid instanceId)
之前已成功加载相同的实例。
我有几个与此例外有关的问题:
答案 0 :(得分:0)
这是否在您的开发机器上,您一直在对工作流程进行更改?我之前收到此错误,不得不清理我的持久性数据库。这是一个可以帮你完成的脚本。
use [AppFabricPersistenceStore]
set nocount on
declare @InstanceId uniqueidentifier
declare @SurrogateInstanceId bigint
declare csr cursor fast_forward for
select InstanceId from [System.Activities.DurableInstancing].Instances
open csr
fetch next from csr into @InstanceId
while @@fetch_status = 0
begin
(
select @SurrogateInstanceId = SurrogateInstanceId
from [System.Activities.DurableInstancing].InstancesTable i
where i.Id = @InstanceId
)
execute [System.Activities.DurableInstancing].DeleteInstance @SurrogateInstanceId
fetch next from csr into @InstanceId
end
close csr
deallocate csr
请告诉我这是否适合您!