Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Host the WF Runtime
 Task 1: Configure Runtime Services ...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Task 1: Configure Runtime Services Using Code

Download sample

In this task, you learn how to add services to the Windows Workflow Foundation by using methods that are defined in the WorkflowRuntime class. In this task and in the next task, you only use the DefaultWorkflowSchedulerService class. Starting with Task 3: Use the Windows Workflow Persistence Service, you learn how to use the other services that are provided by Windows Workflow Foundation.

ms734732.note(en-us,VS.90).gifNote:
Although you are encouraged to follow the exercises in a linear manner, it is not required. You can start this exercise by opening the sample project and proceeding to the steps in the following section.

To add runtime services

  1. In the Program file, import the System.Workflow.Runtime.Tracking namespace so that you can use the types in that namespace.

    C#
    using System.Workflow.Runtime.Tracking;
    
  2. In the Program class, create a static Int32 field named maxSimultaneousWorkflows, and assign it the value 1.

    C#
    static int maxSimultaneousWorkflows = 1;
    
  3. In the Main method that is defined in the Program class, add the DefaultWorkflowSchedulerService to the WorkflowRuntime.

    Use the AddService method, and pass the number of maximum simultaneous workflows that the DefaultWorkflowSchedulerService can schedule as a parameter.

    C#
    workflowRuntime.AddService(
        new DefaultWorkflowSchedulerService(maxSimultaneousWorkflows));
    

    For more information on this value and the DefaultWorkflowSchedulerService, see Using DefaultWorkflowSchedulerService.

Compiling the Code

For information about compiling your code, see Compiling the Code.

In Task 2: Configure Runtime Services using App.Config, you use an application configuration file to add services to the Windows Workflow Foundation.

See Also



Copyright © 2007 by Microsoft Corporation. All rights reserved.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker