In WCF, what happens if there is an unhandled exception ?

 Posted by Akiii on 4/1/2012 | Category: WCF Interview questions | Views: 5203 | Points: 40

The service model returns a generic SOAP fault to the client which does not include any exception specific details by default. However, an exception details in SOAP faults can be included using IncludeExceptionDetailsInFaults attribute. If IncludeExceptionDetailsInFaults is enabled, exception details including stack trace are included in the generated SOAP fault. IncludeExceptionDetailsInFaults should be enabled for debugging purposes only. Sending stack trace details is risky.

IncludeExceptionDetailsInFaults can be enabled in the web.config file :-


<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"/>

Thanks and Regards

Source: Codeproject | | Alert Moderator 

Comments or Responses

Login to post response