Versioning long running Workflow Services in WF4

One of the problems with the current version of Windows Workflow Foundation is how to handle different versions of your workflows. With short running workflows this is no big deal, workflows do whatever they are supposed to do and finish, and you can deploy a newer updated version of your XAMLX files whenever you want. Provided the public facing SOAP interface doesn’t change no one will notice a difference and everything will work just fine. However as soon as we get into long running workflows and the SQL Workflow Instance Store things get quite a bit more complicated. As soon … Continue reading Versioning long running Workflow Services in WF4

Limiting which user can access service using the Windows Identity Foundation

In my previous blog post I demonstrated how to secure a workflow service using the Windows Identity Foundation. With this in place we only allow users that are trusted by the STS Dominick Baier wrote. That is nice but in some cases we might not want all users to be able to perform all actions.   How can we check for individual users against a specific action? Using an STS we don’t get the user credentials from the client application but we do get a lot of information in the form of security tokens from the STS my means of … Continue reading Limiting which user can access service using the Windows Identity Foundation

Securing a Workflow Service using Windows Identity Foundation

The way security is often still handled these days with each application keeping track of their own users is somewhat dated. Some form of Federated security, where a single separate server is responsible for the security of a whole series of applications, is the way to go. On the internet there are plenty of examples of this with applications using things like OAuth and leaving their security to others. In windows the preferred form of federated security is through Windows Identity Foundation and it is real easy to secure an ASP.NET site or WCF service using Windows Identity Foundation.   … Continue reading Securing a Workflow Service using Windows Identity Foundation

Using the WCF OperationContext from a Receive activity

The WF4 Receive activity shields you from a lot of the WCF pipeline. Normally that is a good thing but there are occasions where you want to know more about the incoming WCF request. Normally you can use the WCF OperationContext.Current to get at this information but with a workflow service this doesn’t work as it is null. The reason is that the workflow executes on a different thread.   So how do you get at the OperationContext? The trick is to add a class implementing the IReceiveMessageCallback interface to the NativeActivityContext.Properties while the receive is executing and this will … Continue reading Using the WCF OperationContext from a Receive activity

Converting a C# workflow into XAML

A interesting question that came up last week was how to convert workflows defined in C# to XAML. A co worker of one of the attendees of the Essential Windows Workflow Foundation 4 course had been experiencing a lot of problems with the workflow designer and decided to create their workflows in C# instead of using the designer to generate XAML. While these workflows run just fine you do lose the visual aspect of the designer, one of the benefits of workflow in the first place. Fortunately it isn’t hard to save workflow objects, however they have been authored, into … Continue reading Converting a C# workflow into XAML

Workflows and no persist zones

There are times when a workflow can’t be persisted safely using a SqlWorkflowInstanceStore. The reason isn’t so much saving the state of  a workflow to disk, that could be done at any time, but the result when a workflow would be reloaded from disk in that state. An easy example is a workflow handling a WCF request with a Receive and SendReply activity pair. Suppose you would save the workflow state after the message had been received but before the response had been send. No problem there. Now suppose the workflow is aborted just after the response is send and … Continue reading Workflows and no persist zones

Hiding the XAMLX from a workflow service

In Windows Workflow Foundation 4 it’s easy to create a workflow and expose it as a WCF service. But one thing is that it exposes a XAMLX endpoint to each client can see the service actually implemented as a workflow service instead of a regular service. One way to hide that is to use a regular SVC file as the implementation and point that to a workflow using the WorkflowServiceHostFactory.   See the original XAMLX extension   To change this to an SVC extension we need to do a few things. First we need to use a regular workflow instead … Continue reading Hiding the XAMLX from a workflow service

More Workflow 4 Services and duplex communications

Yesterday I posted a long blog post explaining how to do duplex communications in a Workflow service. Its a long story but the most important points where that workflow services don’t support the same style duplex communication as WCF with the callback channel defined in the ServiceContract but rather something that is called durable duplex where the callback contract is independent and the client has to create a ServiceHost and act as a full-blown WCF service. Also the callback address had to be passed by the client using CallbackContextMessageProperty and the workflow service had to use a callback correlation handle … Continue reading More Workflow 4 Services and duplex communications

Workflow 4 Services and duplex communications

There are quite a a few cases where it is useful to have a duplex communications. An obvious candidate is allowing a service to notify the user interface application of the progress so the user knows what is happening. Normally, when using plain WCF, you would use a ServiceContract attribute with a CallbackContract that specified the service uses duplex communications. For example something like the following code on the server: [ServiceContract(CallbackContract = typeof(IService1Callback))] public interface IService1 { [OperationContract] string GetData(int value); }   [ServiceContract] public interface IService1Callback { [OperationContract] void Reply(string message); } along with a client like this: class … Continue reading Workflow 4 Services and duplex communications