While preparing for one of my Tech-Ed EMEA talks (SOA303 - Long Running Conversations in Workflow Services 3.5 and 4.0) I decided that it was important to make a point about context binding. The point is that you don't have to use the context bindings (basicHttpContextBinding, netTcpContextBinding, wsHttpContextBinding) if you don't have more than one receive activity.
To illustrate the point do the following
- Create a new VS 2008 Project (look under the WCF templates for Sequential Workflow Service Library)
- Drop a CodeActivity on the body of the ReceiveActivity as shown
- Double click on the CodeActivity and add the following code
private void codeActivity1_ExecuteCode(object sender, EventArgs e)
ReturnValue = "You entered: " + inputValue.ToString();
- Run the app using the WCFSvcHost and WCF Test Client to test it
- Enter the value 1 - click on the XML tab and notice the context in the response
- Right click on the app.config and launch the WCF config editor
- Expand the endpoints and on the first endpoint (not the mex endpoint) change the binding to the basicHttpBinding
- Open the IWorkflow1.cs file and change the contract as shown below
public interface IWorkflow1
- Now test your workflow again - this time no context and no need for the context binding as you can see from the response
This is good to know since context exchange places a requirement on apps that want to send a message to your service. As this little demonstration shows, it isn't necessary if you are using just one receive activity to create your workflow service.