Including Exception Details in WCF (IncludeExceptionDetailInFaults)

Sometimes when you receive an exception when debugging a WCF service, you receive the following message :

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

What this is asking you to do is to find your Behaviors section and add the following line.

<serviceDebug includeExceptionDetailInFaults="true" />

To find this section, look in your App.config in your server application. Then find the section which has the behaviors tag. Find the behavior for your application, then add the line above. It should resemble the following :

<behavior name="mexbehavior">
   <serviceMetadata httpGetEnabled="True" httpGetUrl="http://ApplicationURL"/>
   <serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>

Jacob Saylor

Software developer in Kentucky

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: