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" />
</diagnostics>
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