Host Communication Sample

Download sample

This sample demonstrates how to communicate with the workflow host application by using a local service interface.

For the host application to communicate with a running workflow, a local service class must be used. The local service class implements methods that can be called by the host application, and events that the workflow can listen for by using HandleExternalEventActivity activities. An ExternalDataExchangeService service is added to the workflow runtime using AddService; the local service class is then added to the External Data Exchange service. The workflow then accesses the local service by querying for an interface that the local service class implements.

In the sample, an instance of the service class VotingService is added to the runtime. The workflow then interacts with this service by querying for an object that implements the IVotingService interface.

The voting service class and interface support two events: ApprovedProposal and RejectedProposal. The host application raises these events via the CreateBallot method; the events are then handled in the workflow via HandleExternalEventActivity activities (from a ListenActivity activity).

To build the sample

  1. Download the sample by clicking Download Sample.

    This extracts the sample project to your local hard disk.

  2. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  3. Go to the source directory of the sample.

  4. At the command prompt, type MSBUILD <Solution file name>.

To run the sample

  1. In the SDK Command Prompt window, run the .exe file in the HostCommunication\bin\debug folder (or the HostCommunication\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.

See Also


© 2007 Microsoft Corporation. All rights reserved.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft