Compartilhar via


How to: Configure a Workflow Service

Configuring a workflow services client or service is similar to configuring a Windows Communication Foundation (WCF) service, in that an application configuration file is used. The workflow runtime is configured as part of the behaviors section of the service. The following example shows how you can add a SqlWorkflowPersistenceService by adding the workflow runtime as a behavior of the service. The workflow runtime section that is specific to workflow is highlighted in bold:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.serviceModel>
    <services>
      <service name="Microsoft.WorkflowServices.Samples.SequentialCalculatorService" behaviorConfiguration="ServiceBehavior" >
        <host>
          <baseAddresses>
            <add baseAddress="https://localhost:8888/ServiceHost/Calculator.svc" />
          </baseAddresses>
        </host>
        
        <endpoint address="" 
                  binding="wsHttpContextBinding" 
                  contract="ICalculator" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior"  >
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceCredentials>
            <windowsAuthentication
                allowAnonymousLogons="false"
                includeWindowsGroups="true" />
          </serviceCredentials>
          <!-- Comment out the following behavior to disable persistence store -->
          <workflowRuntime name="WorkflowServiceHostRuntime" validateOnCreate="true" enablePerformanceCounters="true">
            <services>
              <add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                   connectionString="Data Source=localhost\sqlexpress;Initial Catalog=NetFx35Samples_ServiceWorkflowStore;Integrated Security=True;Pooling=False"
                   LoadIntervalSeconds="1" UnLoadOnIdle= "true" />
            </services>
          </workflowRuntime>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    
  </system.serviceModel>
  
</configuration>

See Also

Other Resources

Configuring Services Using Configuration Files
Creating Workflow Services and Durable Services