启用持久性时,WF4 中的多个接收活动失败

发布于 2024-10-07 10:23:18 字数 1461 浏览 3 评论 0原文

我有一个具有多个接收功能的 WF4 工作流程。

工作流程运行良好,直到我添加持久性。我创建了持久性表,并将以下内容添加到 web.config 的 \configuration\system.serviceModel\behaviors\serviceBehaviors 部分:

    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true" />
      <sqlWorkflowInstanceStore connectionStringName="InstanceStore"
        instanceCompletionAction="DeleteAll"
        instanceLockedExceptionAction= "NoRetry"
        instanceEncodingOption="None"
        hostLockRenewalPeriod="00:01:00" 
      />
    </behavior>

工作流接受一个参数,该参数是我定义的 WorkflowInstanceDTO POCO 的实例。

当我使用以下代码运行工作流程时,

    var wfi = new WFService.WorkflowInstanceDTO()
    {
        Id = 1,
        InstanceId = new Guid(),
        Description = "Awesome WFI",
        WorkflowId = 1
    };
    proxy.Create(wfi);

它在 proxy.Create 行上失败,并出现以下错误。

实例键值为“11e5cf14-c2a8-0fbf-d3b5-c12a91c174ff” 已经存在。这可能是因为有多个 MessageQuerySets 定义为相同的 CorrelationKey。

当未启用持久性时,我不会收到此错误。有人见过这个吗?我做错了什么?

I have a WF4 workflow with multiple receive functions.

The workflow runs fine until I add persistence. I created the persistence tables and added the following to the \configuration\system.serviceModel\behaviors\serviceBehaviors section of my web.config:

    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true" />
      <sqlWorkflowInstanceStore connectionStringName="InstanceStore"
        instanceCompletionAction="DeleteAll"
        instanceLockedExceptionAction= "NoRetry"
        instanceEncodingOption="None"
        hostLockRenewalPeriod="00:01:00" 
      />
    </behavior>

The workflow accepts a parameter that is an instance of a WorkflowInstanceDTO POCO I have defined.

When I run the workflow with the following code

    var wfi = new WFService.WorkflowInstanceDTO()
    {
        Id = 1,
        InstanceId = new Guid(),
        Description = "Awesome WFI",
        WorkflowId = 1
    };
    proxy.Create(wfi);

It fails on the proxy.Create line with the following error.

An instance key of value '11e5cf14-c2a8-0fbf-d3b5-c12a91c174ff'
already exists. This could be because there are multiple
MessageQuerySets defined that evaluate to the same CorrelationKey.

When persistence is not enabled, I do not get this error. Has anyone seen this? What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情感失落者 2024-10-14 10:23:18

您是否初始化关联并且您的接收活动是否在同一密钥上关联?如果您还没有阅读过基于内容的相关性,您将会想要阅读。

添加 CorrelationHandle 类型的名为“sharedHandle”的工作流变量,并在 Create 调用中使用“查询相关初始值设定项”初始化“sharedHandle”。该属性是所有接收调用都会接受的参数。

Do you initialize correlation and do your receive activities correlate on the same key? You're going to want to read about content-based correlation if you haven't already.

Add a workflow variable called "sharedHandle" of type CorrelationHandle and on your Create call, initialize "sharedHandle" with a "Query correlation initializer". The property would something that all receive calls would accept as an argument.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文