Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 3.0
 Task 1: Configure Runtime Services ...
This page is specific to
.NET Framework 3.0

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 will learn how to use the other services that are provided by Windows Workflow Foundation.

NoteNote

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.

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

    Visual Basic
    Private Shared maxSimultaneousWorkflows As Integer = 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.

    Visual Basic
    workflowRuntime.AddService(New DefaultWorkflowSchedulerService _
                 (maxSimultaneousWorkflows))
    C#
    workflowRuntime.AddService(
        new DefaultWorkflowSchedulerService(maxSimultaneousWorkflows));

Compiling the Code

  1. Click Start, point to Programs, point to Microsoft .NET Framework SDK v2.0, and then click SDK Command Prompt.

  2. Go to the source directory of the tutorial.

  3. At the command prompt, type MSBUILD to build the project.

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

See Also

Footer image
Send comments about this topic to Microsoft.
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker