This chapter covered some of the ways in which ASP.NET and Windows Workflow Foundation can interact. Windows Workflow Foundation is able to sit behind an ASP.NET application just like any other .NET application type. This is useful for wizard-type scenarios, especially one that may be completed over the period of several sessions.
There are also technology-specific issues that you need to consider when determining whether to use a workflow in ASP.NET, the biggest of which concerns the threading model used to execute workflow instances. By default, instances are started on a thread from the thread pool so that the workflow host can continue work while the workflow executes in the background. This may not favorable in a web environment, because a web page may need to wait for some work to be completed before returning control to the user. In addition, IIS and ASP.NET are not meant to have a great deal of their threads used. Therefore, the ManualWorkflowSchedulerService is provided to execute a workflow instance on the same thread as the host.
Finally, this chapter covered the use of Windows Workflow Foundation as a page flow engine in ASP.NET. The MVC pattern was used to ensure that the web forms had no knowledge of the order in which they appear to the users. This approach allows for a great deal of flexibility related to changing the page display order as well as the front-end technology being used. For example, the same workflow could be used to control an ASP.NET application and a Windows Forms application.