从App.Config文件配置Windows Workflow

时间:2009-12-01 18:52:42

标签: workflow-foundation

我以前做过这个,所以我知道这是可能的,但我似乎无法记住如何完成它。我需要从app.config设置LoadingInterval和InstanceOwnershipDuration。有人可以指出我正确的方向。我目前正在使用以下无法正常工作:

    <Runtime>
  <CommonParameters>
    <add name="ConnectionString" value="*****"/>
  </CommonParameters>
  <Services>
    <!-- Persistence -->
    <add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" UnloadOnIdle="true" InstanceOwnershipDuration="10" LoadingInterval="30" />
    <!-- Tracking -->
    <add type="System.Workflow.Runtime.Tracking.SqlTrackingService, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" UseDefaultProfile="true"/>
    <!--Data Exchanges-->
    <add type="System.Workflow.Activities.ExternalDataExchangeService, System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" ConfigurationSection="Workflow/ExternalDataExchangeServices" />
    <!-- Default Workflow Scheduler-->
    <add type="System.Workflow.Runtime.Hosting.DefaultWorkflowSchedulerService, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <!-- Work Batch Service -->
    <add type="System.Workflow.Runtime.Hosting.SharedConnectionWorkflowCommitWorkBatchService, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" EnableRetries="true" />
  </Services>
</Runtime>

1 个答案:

答案 0 :(得分:3)

使用Reflector打开System.Workflow.Runtime程序集并找到SqlWorkflowPersistenceService的以下参数名称:

的ConnectionString
OwnershipTimeoutSeconds
UnloadOnIdle
LoadIntervalSeconds
EnableRetries

所以我设置了如下所示的持久性配置行,一切正常:

<add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService,  
System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" UnloadOnIdle="true" OwnershipTimeoutSeconds="10" LoadIntervalSeconds="30" />