Using built-in tracing and message logging
As WCF developers, we will often encounter some general exceptions or errors (such as “underlying connection closed …..”, “communication object is in faulted state”, “security exception…”) from which we cannot quite determine what is really wrong. Or, in some cases, we might want to have a look at how the WCF runtime is transforming the service operation calls into data messages under the hood. Well, WCF provides a built-in event-tracing and message-logging functionality that can help simplify such general error troubleshooting.
In this recipe, we will demonstrate how we can leverage the tracing and message-logging feature in WCF service development.
How to do it...
You can enable WCF tracing and message logging either by editing the app.config
file directly, or by using the WCF Service Configuration Editor option. Here we will show you the steps for using the WCF Service Configuration Editor tool.
Open the
app.config
file through the WCF Service Configuration...