WCF Analytic Trace Messages

Damir Dobric Posts

Next talks:



Follow me on Twitter: #ddobric




Some of you may know that windows provides by default Event Trace Session called “EventLog-Microsoft-Windows-Application Server-Applications-Analytic”. session.



This session can be enabled by enabling of Analytic-Event log:


Assuming that your service has following diagnostic configuration and both, client and service are running on the same machine the trace will produce messages shown below:

<diagnostics >
          <endToEndTracing propagateActivity="true" messageFlowTracing="true" />


1. The Dispatcher invoked 'BeforeSendRequest' on a ClientMessageInspector of type  'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.StubClientEventSink'.

2. The Client is executing Action '
http://tempuri.org/ICalculator/Add' associated with the 'ICalculator' contract. The message will be sent to 'http://localhost/MyService/Calculator.svc'.

3. The transport sent a message to 'http://localhost/MyService/Calculator.svc'.

4. ServiceHost started: 'Microsoft.Samples.MyService.Calculator'.

5. The transport received a message from 'http://localhost/MyService/Calculator.svc'.

6. The Dispatcher received a message from the transport. Correlation ID == '{00000000-0000-0000-0000-000000000000}'.

7. The Dispatcher invoked 'AfterReceiveReply'(means AfterReceiveRequest) on a MessageInspector of type 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.StubServerEventSink'.

8. An OperationInvoker invoked the 'Add' method. Caller information: '::1:10376'.

9.  Custom Message (if exist)
      Name:'DidAddLogic', Reference:'Default Web Site/MySevicetor.svc|Calculator', Payload:1+7=8

10. An OperationInvoker completed the call to the 'Add' method.  The method call duration was '3' ms.

11. The Dispatcher invoked 'BeforeSendRequest' (means BeforeSendReply) on a MessageInspector of type 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.StubServerEventSink'.

12. The Dispatcher sent a message to the transport. Correlation ID == '{00000000-0000-0000-0000-000000000000}'.

13. The transport sent a message to 'http://localhost/MyService/Calculator.svc'.

14. The transport received a message from 'http://localhost/MyService/Calculator.svc'.

15. The Client completed executing Action 'http://tempuri.org/ICalculator/Add' associated with the 'ICalculator' contract. The message was sent to 'http://localhost/MyService/Calculator.svc'.

17. The Dispatcher invoked 'AfterReceiveReply' on a ClientMessageInspector of type 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.StubClientEventSink'.

Here is the explanation. The blue trace-messages are client trace-messages and red messages are produced by service.
Client implements usually IClientMessageInspector ans Service implements IDispatchMessageInpsector.

public interface IClientMessageInspector
    // Methods
    void AfterReceiveReply(ref Message reply, object correlationState);
    object BeforeSendRequest(ref Message request, IClientChannel channel);
public interface IDispatchMessageInspector
    // Methods
    object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext);
    void BeforeSendReply(ref Message reply, object correlationState);

Mesages 7 and 11 seem to have invalid description, but the sequence is correct. Messages 4 to 13 are traced out if the service is started in debugger. If the service is not started in debugger only messages traced out.Nate that under some circumvents last statement is not always valid.

Posted Oct 23 2010, 01:50 PM by Damir Dobric


Damir wrote re: WCF Analytic Trace Messages
on 05-26-2013 19:11

If you want to redirect all service messages (traces) to analytic event log, you will have to setup etwProvider to following GUID-value:

 <diagnostics etwProviderId="c651f5f6-1c0d-492e-8ae1-b4efd7c9d503">

Sorel wrote re: WCF Analytic Trace Messages
on 12-06-2013 18:11

I drop a comment wheenver I especially enjoy a article on a site or if I have something to contribute to the discussion. It is caused by the passion displayed in the article I browsed. And on this article MCTS 70-503 TS: Microsoft .NET Framework 3.5   Windows Communication Foundation | Inicya e-learning. I was moved enough to drop a comment   I do have 2 questions for you if you tend not to mind. Is it simply me or does it look as if like some of these comments appear as if they are left by brain dead individuals?   And, if you are writing on other online social sites, I'd like to keep up with anything fresh you have to post. Could you make a list all of your public pages like your linkedin profile, Facebook page or twitter feed?

developers.de is a .Net Community Blog powered by daenet GmbH.