Frank Wang's inspirations on .NET

IEnumerable<Inspiration> inspirations = from i in DataContext.Inspirations where i.Sharable == true select i

IncludeExceptionDetailInFaults in WCF service configuration

Wednesday, March 12, 2008 12:46 PM

Often times you have some errors in your WCF service that are not detected until the runtime. It can be very frustrating when you receive "server was unable to process request due to an internal error" but you don't know what exactly is going on.

Exception

If you get the error screen above, go ahead and turned on the IncludeExceptionDetailInFaults in the service configuration file. It's set to "false" by default when Visual Studio generates the configuration file.

<behaviors>
            <serviceBehaviors>
                <behavior name="ServiceGatewayBehavior">
                    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                    <serviceMetadata httpGetEnabled="true"/>
                    <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>

 

Restart the debugging again and you will see the exact details of the internal error. Although this configuration is helpful for the debugging, you should always turn if OFF before the service goes alive.


Feedback

# re: IncludeExceptionDetailInFaults in WCF service configuration

Excellent! intellisence does not give me any help to get this line. You´ve done! 6/13/2008 7:28 AM | Leonardo

Post a comment





 

Please add 5 and 2 and type the answer here: