System and Application Softwares
Tools and Utilites
Using Service Trace Viewer to Diagnose WCF Service
Windows Communication Foundation (WCF) Service Trace Viewer Tool (SvcTraceViewer.exe) helps you analyze diagnostic traces that are generated by WCF. Service Trace Viewer provides a way to easily merge, view, and filter trace messages in the log so that you can diagnose, repair, and verify WCF service issues.
Diagnostic traces provide you with information that shows what is happening throughout your application's operation. As the name implies, you can follow operations from their source to destination and through intermediate points as well.
You can configure tracing using the application’s configuration file—either Web.config for Web-hosted applications, or Appname.config for self-hosted applications. The following is an example:
<trace autoflush="true" />
initializeData= "SdrConfigExample.e2e" />
In this example, the name and type of the trace listener is specified. The Listener is named sdt and the standard .NET Framework trace listener (System.Diagnostics.XmlWriterTraceListener) is added as the type. The initializeData attribute is used to set the name of the log file for that Listener to be SdrConfigExample.e2e. For the log file, you can substitute a fully-qualified path for a simple file name.
The example creates a file in the root directory called SdrConfigExample.e2e. When you use the Trace Viewer to open the file as described in the “Opening and Viewing WCF Trace Files” section, you can see all the messages that have been sent.
The tracing level is controlled by the switchValue setting. The available tracing levels are described in the following table.
Logs Fail-Fast and Event Log entries, and trace correlation information. The following are some examples of when you might use the Critical level:
Your AppDomain went down because of an unhandled exception.
Your application fails to start.
The message that caused the failure originated from the process MyApp.exe.
Logs all exceptions. You can use the Error level in the following situations:
Your code crashed because of an Invalid Cast Exception.
A "failed to create endpoint" exception is causing your application to fail on startup.
A condition exists that may subsequently result in an error or critical failure. You can use this level in the following situations:
The application is receiving more requests than its throttling settings allows.
The receiving queue is at 98 percent of its configured capacity.
Messages helpful for monitoring and diagnosing system status, measuring performance, or profiling are generated. You can utilize such information for capacity planning and performance management. You can use this level in the following situations:
A failure occurred after the message reached the AppDomain and was deserialized.
A failure occurred while the HTTP binding was being created.
Debug-level tracing for both user code and servicing. Set this level when:
You are not sure which method in your code was called when the failure occurred.
You have an incorrect endpoint configured and the service failed to start because the entry in the reservation store is locked.
Flow events between processing activities and components.
This level allows administrators and developers to correlate applications in the same application domain.
Traces for activity boundaries: start/stop.
Traces for transfers.
You can use add to specify the name and type of the trace listener you want to use. In the example configuration, the Listener is named sdt and the standard .NET Framework trace listener (System.Diagnostics.XmlWriterTraceListener) is added as the type. Use initializeData to set the name of the log file for that Listener. In addition, you can substitute a fully-qualified path for a simple file name.
© 2019 Digcode.com. All rights reserved.