您可以参考 WCf_WF_sample 进行跟踪。你可以从这里下载。
http://www.microsoft.com/en-us/download/details.aspx?id=21459
下面给出了 sql server 的示例跟踪配置文件。
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<connectionStrings>
<add connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=TrackingSample;Integrated Security=SSPI"
name="TrackingDbConnection" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="sqlTracking" type="Microsoft.Samples.SqlTracking.SqlTrackingExtensionElement, SqlTrackingParticipant, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior>
<sqlTracking profileName="Troubleshooting Profile"
connectionStringName="TrackingDbConnection"/>
<serviceDebug includeExceptionDetailInFaults="False" />
<serviceMetadata httpGetEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
<tracking>
<profiles>
<trackingProfile name="Troubleshooting Profile">
<workflow activityDefinitionId="*">
<workflowInstanceQueries>
<workflowInstanceQuery>
<states>
<state name="*" />
</states>
</workflowInstanceQuery>
</workflowInstanceQueries>
<activityStateQueries>
<activityStateQuery activityName="*">
<states>
<state name="*" />
</states>
<variables>
<variable name="*"/>
</variables>
</activityStateQuery>
</activityStateQueries>
<activityScheduledQueries>
<activityScheduledQuery activityName="*" childActivityName="*" />
</activityScheduledQueries>
<faultPropagationQueries>
<faultPropagationQuery faultSourceActivityName="*" faultHandlerActivityName="*" />
</faultPropagationQueries>
<customTrackingQueries>
<customTrackingQuery name="*" activityName="*" />
</customTrackingQueries>
</workflow>
</trackingProfile>
<trackingProfile name="Instance_And_Custom_Records">
<workflow activityDefinitionId="*">
<workflowInstanceQueries>
<workflowInstanceQuery>
<states>
<state name="*" />
</states>
</workflowInstanceQuery>
</workflowInstanceQueries>
<customTrackingQueries>
<customTrackingQuery name="*" activityName="*" />
</customTrackingQueries>
</workflow>
</trackingProfile>
</profiles>
</tracking>
</system.serviceModel>
</configuration>
您也可以参考这些链接以获得更多理解。
http://msdn.microsoft.com/en-us/library/ee513992.aspx