We just published a WF Hosting Quickstart sample today and it shows a common hosting model for building WF programs and running them in either of:
- ASP.NET and IIS
- Your NT Service
- A Console Host
Okay the third is just a debugging convenience for the second. This sample provides a simple layer that means you don’t have any changes to your workflows and your WF Runtime Services whether running on either the first of second type of host. You should think of using this project as a start for building your own hosting environment for Windows Workflow Foundation projects. This joins a collection of other examples of WF Hosting which are also available:
- A simple human task based ASP.NET WF host
- Hosting WF workflows in BizTalk Server
- The Visual Studio 2008 project template for hosting in a Console Application
- Hosting examples in the SDK
- A hosting Hands on Lab in both C# and VB.NET
It works with either Visual Studio 2005 or Visual Studio 2008. If you’re still on 2005 you will need the .NET Framework 3.0 add-ons for WF.
Here’s a simple walkthrough, although the readme in the sample also walks through this.
- Open the ZIP file
- Open the whitepaper and review it
- Open the VSI from the ZIP file – This part requires Visual Studio to be installed. You’ll get an error otherwise.
- The VSI will prompt to accept installation of the addins and for a simple license
- Once this is done start Visual Studio
- Create a new project
- Choose the Visual C# node
- Click okay to create the project
- I don’t have SQL Server express so I had to attach to the provided sql database and change the web.config and app.config files. This is my new connection string.
- Press F5 to run the web hosting project
- Set the WFWCFWindowsService project to the startup project and press F5 to run the NT Service hosted project. It runs as a console application by default to aid in debugging
- Right click and start the WCFClient project to connect to the NT Service.
- Continue to customise the code for your host requirements.