I have a WCF service and there is a CustomFaultException class inheriting from FaultException.
I have set the below code:
<serviceDebug includeExceptionDetailInFaults="False"/>
But it always returns the Exception with full stack trace details.
How to configure or implement a WCF Service so that only returns certain types of Exceptions e.g. CustomFaultException?
Thanks
Add the following attribute to your Service Operation:
[FaultContract(typeof(CustomFaultException))]
Within your catch, add the following:
throw new CustomFaultException("Custom Fault Message");
This will prevent the full stack trace exception details from being sent to the client.