title: WCF - A web service running in IIS but through a factory doesn't keep up the original exception thrown
body: <p>A web service running in IIS but through a factory doesn't keep up the original exception thrown.</p>
  
  <p>For example:</p>
  
  <p>My web service has been marked up with FaultContractAttribute like this way:</p>
  
  <pre><code>public interface IMyService
  {
      [FaultContract(typeof(MyCustomException))]
      [OperationContract]
      bool IsAuthorized();
  }
  </code></pre>
  
  <p>My web service implementation has throws out a custom exception like this way:</p>
  
  <pre><code>public class MyService : IMyService
  {
      public bool IsAuthorized()
      {
          throw new FaultException&lt;MyCustomException&gt;(fault, fr);
      }
  }
  </code></pre>
  
  <p>Then:</p>
  
  <ol>
  <li><p>If my WCF - NOT using any factory - is similar to <code>&lt;%@ ServiceHost Language="C#" Debug="true" Service="MyService" %&gt;</code>, then on client side I CAN pick up the original exception (MyCustomException)</p></li>
  <li><p>If my WCF - USING some factory - is similar to <code>&lt;%@ ServiceHost Language="C#" Debug="true" Service="MyService" Factory="MyFactory" %&gt;</code>, then on client side I CAN'T pick up the original exception (MyCustomException) but only SOAP exception (FaultException) with useless general trace &amp; message</p></li>
  </ol>
  
  <p>Note:</p>
  
  <p>WCF factory MyFactory is implemented with its SERVICE HOST contains a SERVICE BEHAVIOR initiated from IErrorHandler</p>
  
  <p>In this service behavior, method ProvideFault does nothing (I haven't known how to keep up the original exception by this way)</p>
  
  <p>In summary, I beg answers from expects: How to keep up the original exception (MyCustomException) while using some WCF factory ?
  Thanks.</p>