13
Q8M1 – SC Dudy Fathan Ali S.Kom Distributed Application Development Tracing and Monitoring WCF Services Dudy Fathan Ali, S.Kom (DFA) 2017 CEP - CCIT Fakultas Teknik Universitas Indonesia

Tracing and Monitoring WCF Services

Embed Size (px)

Citation preview

Page 1: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Distributed Application Development

Tracing and Monitoring WCF Services

Dudy Fathan Ali, S.Kom (DFA)2017

CEP - CCITFakultas Teknik Universitas Indonesia

Page 2: Tracing and Monitoring WCF Services

Additional Documents

Q8M1 – SC Dudy Fathan Ali S.Kom

bit.ly/4sc1-repo

Download this Powerpoint Slide:

Page 3: Tracing and Monitoring WCF Services

Objectives

Q8M1 – SC Dudy Fathan Ali S.Kom

Implementing Tracing

Configuring Tracing

Monitor a WCF Service

Page 4: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Implementing Tracing

Distributed Application Development

o Tracing:

o Is used to keep a track of the service execution.

o Helps you to enhance the performance of a WCF service by analyzing its behavior and identifying errors.

o Enables you to view diagnostic information about the service.

o Can be used to display custom tracing information, such as customized messages about the execution of the service.

Page 5: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Implementing Tracing

Distributed Application Development

o WCF enables you to analyze and examine a WCF service by implementing tracing.

o WCF allows you to compare and correlate the errors and processes of WCF services by implementing end-to-end (e2e) tracing.

o End-to-End tracing enables you to trace the execution of the code of a WCF service to provide detailed tracing information.

o WCF provides the following mechanisms called correlation mechanisms to diagnose the cause of the error:

o Activity

o Transfer

o Propagation

Page 6: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Implementing Tracing

Distributed Application Development

o Activity:

o An activity is a processing unit that helps you to reduce the scope of error generation.

o The errors that occur in the same activity are directly related to each other.

o To trace the errors that occur in an activity, you need to write the following code snippet:

<system.diagnostics>

<sources>

<source name="System.ServiceModel" switchValue="

Information, ActivityTracing" >

</source>

</sources>

</system.diagnostics>

Page 7: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Implementing Tracing

Distributed Application Development

o Transfer:

o Between activities represent causal relationship between events in the related activities.

o Between activities happens when the control flows from one activity to another.

Page 8: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Implementing Tracing

Distributed Application Development

o Propagation:

o Propagation enables you to group the tracing information of errors that occurred in the same activity across endpoints.

o This enables you to compare and correlate the grouped tracing information and find the cause of the errors.

o To implement propagation in a WCF service, you need to write the following code snippet:

<system.diagnostics>

<sources>

<source name="System.ServiceModel" switchValue="

Information, ActivityTracing“ propagateActivity="true">

</source>

</sources>

</system.diagnostics>

Page 9: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Implementing Tracing

Distributed Application Development

o Steps to create WCF Diagnostic Implementation

1. Create a new WCF Service Application

2. Edit the Web.Config and add the configuration code

3. Run the service

4. Open the service log file using WCF Service Trace Viewer

Page 10: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Configuring Tracing

Distributed Application Development

o To create and configure a trace listener, you can write the following code snippet in the web.config file of a WCF service:

<system.diagnostics>

<trace autoflush="true" />

<sources>

<source name="System.ServiceModel" switchValue="Information, ActivityTracing">

<listeners>

<add name="xml"/>

</listeners>

</source>

<source name="System.ServiceModel.MessageLogging">

<listeners>

<add name="xml"/>

</listeners>

</source>

</sources>

<sharedListeners>

<add name="xml"

type="System.Diagnostics.XmlWriterTraceListener"

initializeData= “path\to\directory" />

</sharedListeners>

</system.diagnostics>

Page 11: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Configuring Tracing

Distributed Application Development

o Add this following code in System.ServiceModel section:

<diagnostics>

<messageLogging

logEntireMessage="true"

logMalformedMessages="true"

logMessagesAtServiceLevel="true"

logMessagesAtTransportLevel="true"

maxMessagesToLog="3000"

/>

</diagnostics>

Page 12: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Monitor a WCF Service

Distributed Application Development

o Launch the WCF Service Trace Viewer (svctraceviewer.exe) and open the log file from the location and path specified in your web.config.

Page 13: Tracing and Monitoring WCF Services

Q8M1 – SC Dudy Fathan Ali S.Kom

Thank You!Dudy Fathan Ali, S.Kom

[email protected]