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.
In the Program file, import the System.Workflow.Runtime.Tracking namespace so that you can use the types in that namespace.
using System.Workflow.Runtime.Tracking;
In the Program class, create a static Int32 field named maxSimultaneousWorkflows, and assign it the value 1.
static int maxSimultaneousWorkflows = 1;
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.
workflowRuntime.AddService( new DefaultWorkflowSchedulerService(maxSimultaneousWorkflows));
For more information on this value and the DefaultWorkflowSchedulerService, see Using DefaultWorkflowSchedulerService.
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.