title: How can I get WCF FaultException when server returns an HTTP 401?
body: <p>I have a WCF based test harness client for a set of web services.  The test client allows me to see raw requests and responses going to and from the services. A Message Inspector endpoint behavior is used to "pick off" the raw requests and response messages and save them for later display in the UI.</p>
  
  <p>This works great, except for the use case where invalid credentials are passed.  The server returns an HTTP 401 along with a SOAP fault containing details of what happened.  This hurts me in a couple ways:</p>
  
  <ol>
  <li>On the client this shows up as a <code>MessageSecurityException</code> not a <code>FaultException</code>, so I can't get the details from the fault.</li>
  <li>This exception appears to prevent the <code>AfterReceiveReply</code> event handler on my message inspector from firing, so I have no access to the raw response.</li>
  </ol>
  
  <p>Is there any way I can handle this case so that the SOAP fault comes through as a FaultException and allow my message inspector to handle responses regardless of the HTTP status code that is returned?</p>
  
  <p>Thanks!</p>