【问题标题】:Multiple Receive Activities in WF4 fails when persistence is enabled启用持久性后,WF4 中的多个接收活动失败
【发布时间】:2010-12-13 23:55:19
【问题描述】:

我有一个带有多个接收功能的 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);

在代理上失败。创建行并出现以下错误。

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

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

【问题讨论】:

    标签: workflow persistence workflow-foundation-4


    【解决方案1】:

    您是否初始化关联并且您的接收活动是否与同一个键关联?如果您还没有阅读有关基于内容的相关性的内容,您会想阅读。

    添加一个名为“sharedHandle”的 CorrelationHandle 类型的工作流变量,然后在您的 Create 调用中,使用“查询相关初始化程序”初始化“sharedHandle”。该属性将是所有接收调用都会接受的参数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多