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.