Partilhar via


SAMPLE WF CONFIG FOR NLB SCENARIO

If you are deploying your workflow application to multiple machines(NLB scenario) and all these machines are using same database for persistence , you need to use following config

(1)OwnershipTimeoutSeconds should be very high value ,so other hosts can't load these workflows

(2)Disable auto unload

SAMPLE WORKFLOW CONFIG:

<WorkflowRuntime Name="WorkflowServiceContainer">

<CommonParameters>

<add name="ConnectionString" value="Initial Catalog=SHARED;Data Source=localhost;Integrated Security=SSPI;"/>

</CommonParameters>

<Services>

<add type="System.Workflow.Runtime.Hosting.ManualWorkflowSchedulerService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

<add type="System.Workflow.Activities.ExternalDataExchangeService, System.Workflow.Activities, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" ConfigurationSection="ExternalDataExchange"/>

<add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" UnloadOnIdle="false" OwnershipTimeoutSeconds="5000" LoadIntervalSeconds="0" />

<add type="System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<add type="System.Workflow.Runtime.Tracking.SqlTrackingService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" IsTransactional="false"/>

</Services>

</WorkflowRuntime>

 

AFTER WE ARE DONE WITH WORKFLOW, WE CAN CALL THIS METHOD TO UNLOAD WORKFLOW MANUALLY:

 

StateMachineWorkflowInstance stateInstance = new StateMachineWorkflowInstance(Application["WorkflowRuntime"] as WorkflowRuntime, instanceId);

stateInstance.WorkflowInstance.Unload();

Comments