File Tracking Service and Query Sample

Download sample

This file-based tracking service reads tracking profiles from a file, writes received tracking information to a text file, and also provides a simple query layer to get a list of tracked workflow events.

The sample demonstrates an end-to-end usage of the tracking feature in Windows Workflow Foundation:

  • Create a simple service.

  • Add the service to the runtime.

  • Use the simple tracking service to track and save workflow information.

  • Use the resulting files to query workflow events.

The sample consists of four projects:

  1. SimpleWorkflowsLibrary contains the following:

    • ExceptionWorkflow: A workflow that throws an ApplicationException from a CodeActivity activity. Instances of this workflow are expected to raise an exception and then terminate.

    • SuspendedWorkflow: A workflow that contains a SuspendActivity activity. Instances of this workflow are expected to be suspended.

    • SimpleWorkflow: A workflow that contains a CodeActivity activity. Instances of this workflow are expected to finish successfully.

  2. SimpleFileTrackingService contains the following:

    • SimpleFileTrackingService: Contains a file-based tracking service, SimpleFileTrackingService, and SimpleTrackingChannel. The SimpleFileTrackingService implements the GetProfile method that is called by the tracking service to request a tracking profile for specific types. The SimpleTrackingChannel implements the Send method that is called by the tracking service to send various tracking records.

    • SimpleFileTrackingServiceQuery: Represents the query layer that reads tracked Workflow Events from tracking file.

  3. QueryUI is the main entry point for the application. This project also acts as the host application and provides a user interface to display workflow event tracking data.

  4. WorkflowConsoleApplication is the main hosting application for running the workflows and generating the tracking data that can be viewed in the QueryUI application.

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. Run the WorkflowConsoleApplication.exe file in the WorkflowConsoleApplication\bin\debug folder (or the WorkflowConsoleApplication\bin folder for the Visual Basic version of the sample), which is below the source folder of the sample.

    This creates the tracking profile.


    The sample must be run from the current working directory; otherwise the application cannot find the tracking file.

  2. Run the SimpleFileTrackingServiceQueryUI.exe file in the QueryUI\bin\debug folder, which is located below the source folder of the sample.

  3. Enter an instance ID of one of the workflows that ran in step 1, and then click Get Tracked Workflow Events.

    To determine the instance ID, look at the output of the sample:

    Saving tracking information to C:\DOCUME~1\<user>\LOCALS~1\Temp\

See Also



Other Resources

Tracking Samples
Simple Tracking Sample
Query Using SQLTrackingService Sample
Tracking Using User Track Points Sample
EventArgs Tracking Sample
ConsoleTrackingService Sample
Query Using SQLTrackingService Sample
RuleActionTrackingEvent Sample
Using the Tracking Profile Object Model Sample
Windows Workflow Tracking Services

© 2007 Microsoft Corporation. All rights reserved.