简体   繁体   English

在长时间运行的工作流服务上调用操作(接收活动)时,WF4错误

[英]WF4 error when calling operations (receive activities) on long running workflow service

The error: The execution of an InstancePersistenceCommand was interrupted because the instance '42ca66e7-35e3-462e-9594-a98ee009d2e2' has not yet been persisted to the instance store. 错误:InstancePersistenceCommand的执行被中断,因为实例'42ca66e7-35e3-462e-9594-a98ee009d2e2'尚未持久保存到实例存储中。

This happens when I call the 2nd receive activity on an existing workflow instance that has been unloaded from memory. 当我在已从内存中卸载的现有工作流程实例上调用第二次接收活动时,就会发生这种情况。 If the instance is still in memory, I don't have the problem. 如果实例仍在内存中,则没有问题。 The instance gets unloaded after waiting for 1 minute or stopping the debugger. 等待1分钟或停止调试器后,实例将被卸载。

I can see a record in the System.Activities.DurableInstancing.InstancesTable table with the id 42CA66E7-35E3-462E-9594-A98EE009D2E2. 我可以在System.Activities.DurableInstancing.InstancesTable表中看到一条ID为42CA66E7-35E3-462E-9594-A98EE009D2E2的记录。

Any idea why I'm having this problem? 知道我为什么遇到这个问题吗?

Update 更新资料

It seems like my state of the workflow isn't being persisted and/or persistence isn't happening properly. 好像我的工作流状态没有被持久化和/或持久性没有正确发生。 Here's is a workflow instance record in the System.Activities.DurableInstancing.InstancesTable table. 这是System.Activities.DurableInstancing.InstancesTable表中的工作流实例记录。 Is it just me or should I see some serialized state in there somewhere? 是我还是我应该在某个地方看到一些序列化状态?

What would happen if I were using a class not marked as [Serializable] in my workflow and tried to persist it? 如果我在工作流程中使用未标记为[Serializable]的类并尝试将其持久化会怎样?

I found that serialization was being interrupted because of some problems with some types that were used in the workflow. 我发现序列化由于工作流中使用的某些类型的某些问题而被中断。

The first problem was that I had marked a property with [DataMember] that didn't have a set accessor. 第一个问题是我用[DataMember]标记了一个没有设置访问器的属性。 NetDataContractSerializer wasn't able to serialize that type until I removed the attribute. 在删除属性之前,NetDataContractSerializer无法序列化该类型。

The second problem was that I had a workflow variable of type IEnumerable, which obviously isn't marked as Serializable or DataContract. 第二个问题是我有一个类型为IEnumerable的工作流变量,显然它没有被标记为Serializable或DataContract。 I'm not sure what I was thinking when I did that. 我不确定这样做时的想法。

These problems were easy to spot after learning about the WorkflowServiceTraceBehavior on Ron Jacobs blog . 了解Ron Jacobs博客上WorkflowServiceTraceBehavior 之后 ,很容易发现这些问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM