Windows Communication Foundation (WCF) provides a rich set of functionalities that can help you monitor the different stages of an application’s life. For example, you can use configuration to set up services and clients at deployment. WCF includes a large set of performance counters to help you gauge your application's performance. WCF also exposes inspection data of a service at runtime through a WCF Windows Management Instrumentation (WMI) provider. When the application experiences a failure or starts acting improperly, you can use the Event Log to see if anything significant has occurred. You can also use Message Logging and Tracing to see what events are happening end-to-end in your application. These features assist both developers and IT professionals to troubleshoot an WCF application when it is not behaving correctly.

Note

If you are receiving faults with no specific detail information, you should enable the includeExceptionDetailInFaults attribute of the <serviceDebug> configuration element. This instructs WCF to send exception detail to clients, which enables you to detect many common problems without requiring more advanced diagnosis. For more information, see Sending and Receiving Faults.

Diagnostics Features Provided by WCF

WCF provides the following diagnostics functionalities:

• End-To-End tracing provides instrumentation data for troubleshooting an application without using a debugger. WCF outputs traces for process milestones, as well as error messages. This can include opening a channel factory or sending and receiving messages by a service host. Tracing can be enabled for a running application to monitor its progress. For more information, see the Tracing topic. To understand how you can use tracing to debug your application, see the Using Tracing to Troubleshoot Your Application topic.

• Message logging allows you to see how messages look both before and after transmission. For more information, see the Message Logging topic.

• Event tracing writes events in the Event Log for any major issues. You can then use the Event Viewer to examine any abnormalities. For more information, see the Event Logging topic.

• Performance counters exposed through Performance Monitor enable you to monitor your application and system's health. For more information, see the Performance Counters topic.

• The System.ServiceModel.Configuration namespace allows you to load configuration files and set up a service or client endpoint. You can use the object model to script changes to many applications when updates must be deployed to many computers. Alternatively, you can use the Configuration Editor Tool (SvcConfigEditor.exe) to edit the configuration settings using a GUI wizard. For more information, see the Configuring Your Application topic.

• WMI enables you to find out what services are listening on a machine and the bindings that are in use. For more information, see the Using Windows Management Instrumentation for Diagnostics topic.

WCF also provides several GUI and command line tools to make it easier for you to create, deploy, and manage WCF applications. For more information, see Windows Communication Foundation Tools. For example, you can use the Configuration Editor Tool (SvcConfigEditor.exe) to create and edit WCF configuration settings using a wizard, instead of editing XML directly. You can also use the Service Trace Viewer Tool (SvcTraceViewer.exe) to view, group, and filter trace messages so that you can diagnose, repair, and verify issues with WCF services.