Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
What are the readymade trace events and they are available for which WCF objects ?
In this article we will look how we can trace and debug information in WCF services.
There are some ready made tracelisteners provided by WCF. The base of these ready
made trace listeners is .NET trace listener. So we will first understand the basic
concept of trace listener and then go through the ready made tracelisteners provided
by WCF.
Now a days I am distributing my 400 questions and answers ebook which covers
major .NET related topics like WCF,WPF,WWF,Ajax,Core .NET,SQL
Server,Architecture and lot lot more. I am sure you will enjoy this ebook.
http://www.questpond.com/SampleDotNetInterviewQuestionBook.zip
If you are new to WCF I will recommend give one read to my WCF FAQ’s before
reading this article at
Part 1 :-http://www.codeproject.com/KB/aspnet/WCF.aspx
. It will help you to understand WCF fundamentals so that you can understand this
article much better.
Figure - TraceListener
What are the readymade trace events and they are available for
which WCF objects ?
You can always use the core ‘Tracelistener’ events provided by .NET , but WCF has
readymade trace listeners for the core WCF objects.
• Message process
• Reading of configuration information
System.ServiceModel
• Transport-level action
• Security requests
Now if you run the WCF service you can see a XML file created as shown below.
In the previous question we have specified switch value as information. This value
indicates what type and level of tracing information you want to record. Below is the
list of the same.
You can log WCF message at two levels one is service level and the other is transport
level. Service level:-In this the messages are logged as they enter the user code or
leave the user code. Transport level: - In this the messages are logged as they are
ready to be encoded / decoded. All transport level, infrastructure messages and also
reliable messaging is logged. You specify the message levels in the diagnostics node
as shown in the below code snippet.
‘Messagelogging’ also has other attributes , below is the short description about the
same.
Attribute Description
Should the entire message be logged on only the
logEntireMessage
header.
logMalformedMessages Should malformed messages be logged.
logMessagesAtServiceLevel Should service-level messages be logged.
logMessagesAtTransportLevel Should transport level messages be logged.
Number indicating how many messages should be
maxMessageToLog
logged.
maxSizeOfMessageToLog The default value is 256Kb. Max size of the message log.