How to Catch Exceptions thrown by a WCF service In Client

You can easily get the server side Unhandled exceptions thrown by a WCF service in Client by using FaultException

Set includeExceptionDetailInFaults to true in your service behaviours

<behavior name=””>
<serviceMetadata httpGetEnabled=”false” />
<serviceDebug includeExceptionDetailInFaults=”true” />

and then in client side you can catch exceptions like below
//your service call
catch (FaultException ex)
string msg = "FaultException: " + ex.Message;
MessageFault fault = ex.CreateMessageFault();
if (fault.HasDetail)
System.Xml.XmlReader reader = fault.GetReaderAtDetailContents();
if (reader.Name == "ExceptionDetail")
var detail = fault.GetDetail<Exception>();
msg += "\n\nStack Trace: " + detail.StackTrace;

Enjoy Programming…