Receiving and replying to a WCF message in code workflow

In this task, we will create a code workflow with Receive and SendReply activities, and will run the workflow as a WCF service. This workflow will accept two integer numbers and return the addition sum to the caller. This workflow is hosted in a console application rather than IIS. We will use WCF Test Client to test the service.

How to do it...

  1. Create a workflow Console Application project:

    Create a new Workflow Console Application named ReceiveAndReplyInCode.

  2. Create the workflow in code:

    Add a new class file to the project and name it ReceiveAndReplyWorkflow.cs. Fill the file with the following code:

    using System; using System.ServiceModel.Activities; using System.Activities; using System.ServiceModel; ...

Get Microsoft Windows Workflow Foundation 4.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.