All Blogs

Hosting Coded WFs in WorkflowServiceHost

Aug 07, 2012 2 min read
Default Image

This post is a very quick one. I have been talking to a few people at www.stackoverflow.com who are quite keen to see if we can get WFSH (WorkflowServiceHost) to host coded WFs as opposed to XAML WFs. Further a couple of people also wanted to see if there is a way to get WFSH to host a WF without a Send/Receive activity pair.

I am much too busy with office to do a complete elaborate post right now but I am uploading a sample code base which shows exactly how to achieve all this. Basically using this approach you can have a coded WF or a WF without Send/Receive activities and still get WFSH to host that WF. The approach is almost a hack but hey a developer’s gotta do what a developer’s gotta do! It basically revolves around defining a virtual end point for a WF (which is defined in a different assembly). When IIS gets a request for this service it uses the custom end point to create a new instance of the workflow and start executing it in the WFSH. You will also notice that I am using a Custom worfklow service host factory. Using a custom factory enables us to setup extensions and configure the host the way we want to.

There is one limitation though, we are exposing our WFs as WCF services which we really shouldn’t have to do. However you can easily switch to net.pipe addresses (post coming up soon on these) and limit the access to these WCF services from outside world. Besides since they are WCF services you can limit the authorization/authentication to however you want.

It might be a bit tricky to understand the code at one go so if you need more explanations leave me a message here and I will type out a short synopsis.

You can download the code here.

Explore Our Latest Articles

Default Image
28 May 2026 8 min read

How to customise work item types in Almo Customising work item types in Almo means controlling the list of Azure…

Default Image
28 May 2026 8 min read

How to find Azure DevOps work items from Outlook with Almo Discover Almo’s Discover feature lets you find any Azure…

Default Image
28 May 2026 7 min read

How to change your Working Project in Almo Your Working Project is the Azure DevOps project Almo treats as home,…

Save up to 70 Minutes Daily

Integrate Azure DevOps Service and Microsoft Outlook

Almo accelerates productivity by bringing work item creation and modification experience within Microsoft Outlook. Now create a new work item, link it to an existing Outlook email and fetch its latest state from Azure DevOps Service with our single-click Microsoft addin.