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.
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.