在长时间运行的工作流服务上调用操作(接收活动)时出现 WF4 错误
错误: InstancePersistenceCommand 的执行被中断,因为实例“42ca66e7-35e3-462e-9594-a98ee009d2e2”尚未持久保存到实例存储中。
当我在已从内存中卸载的现有工作流实例上调用第二个接收活动时,会发生这种情况。如果实例仍在内存中,那么我就没有问题。等待 1 分钟或停止调试器后,实例将被卸载。
我可以在 System.Activities.DurableInstancing.InstancesTable 表中看到一条 id 为 42CA66E7-35E3-462E-9594-A98EE009D2E2 的记录。
知道为什么我会遇到这个问题吗?
更新
看来我的工作流程状态没有被持久化和/或持久化没有正确发生。 这是 System.Activities.DurableInstancing.InstancesTable 表中的工作流实例记录。 是我一个人的问题还是我应该在某处看到一些序列化状态?
如果我在工作流程中使用未标记为 [Serialized] 的类并尝试保留它,会发生什么情况?
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.
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.
I can see a record in the System.Activities.DurableInstancing.InstancesTable table with the 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. 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现由于工作流程中使用的某些类型存在一些问题,序列化被中断。
第一个问题是我用 [DataMember] 标记了一个没有设置访问器的属性。在我删除该属性之前,NetDataContractSerializer 无法序列化该类型。
第二个问题是我有一个 IEnumerable 类型的工作流变量,它显然没有标记为 Serialized 或 DataContract。我不确定我这样做时在想什么。
了解Ron Jacobs 博客上的 WorkflowServiceTraceBehavior。
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. NetDataContractSerializer wasn't able to serialize that type until I removed the attribute.
The second problem was that I had a workflow variable of type IEnumerable, which obviously isn't marked as Serializable or 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.