This topic describes activity propagation in the Windows Communication Foundation (WCF) tracing model.

Using Propagation to Correlate Activities Across Endpoints

Propagation provides the user with direct correlation of error traces for the same unit of processing across application endpoints, for example, a request. Errors emitted at different endpoints for the same unit of processing are grouped in the same activity, even across application domains. This is done through propagation of the activity ID in the message headers. Therefore, if a client times out because of an internal error in the server, both errors appear in the same activity for direct correlation.

To do this, use the ActivityTracing setting as demonstrated in the previous example. In addition, set the propagateActivity attribute for the System.ServiceModel trace source at all endpoints.

<source name="System.ServiceModel" switchValue="Verbose,ActivityTracing" propagateActivity="true" >  

Activity propagation is a configurable capability that causes WCF to add a header to outbound messages, which includes the activity ID on the TLS. By including this on subsequent traces on the server side, we can correlate client and server activities.

Propagation Definition

Activity M’s gAId is propagated to activity N if all of the following conditions apply.

  • N is created because of M

  • M’s gAId is known to N

  • N's gAId is equal to M’s gAId.

The gAId is propagated through the ActivityId message header, as illustrated in the following XML schema.

<xsd:element name="ActivityId" type="integer" minOccurs="0">  
  <xsd:attribute name="CorrelationId" type="integer" minOccurs="0"/>  

The following is an example of the message header.

  <s:Envelope xmlns:s=""
      <a:Action s:mustUnderstand="1">http://Microsoft.ServiceModel.Samples/ICalculator/Subtract  
      <ActivityId CorrelationId="f94c6af1-7d5d-4295-b693-4670a8a0ce34"
      <a:To s:mustUnderstand="1">net.tcp://localhost/servicemodelsamples/service</a:To>  
     <Subtract xmlns="http://Microsoft.ServiceModel.Samples">  

Propagation and Activity Boundaries

When the activity ID is propagated across endpoints, the message receiver emits a Start and Stop traces with that (propagated) activity ID. Therefore, there is a Start and Stop trace with that gAId from each trace source. If the endpoints are in the same process and use the same trace source name, multiple Start and Stop with the same lAId (same gAId, same trace source, same process) are created.


To synchronize events across endpoints that run on different machines, a CorrelationId is added to the ActivityId header that is propagated in messages. Tools can use this ID to synchronize events across machines with clock discrepancy. Specifically, the Service Trace Viewer tool uses this ID for showing message flows between endpoints.

See also