Error Handling in WCF WebHttp Services with WebFaultException only xml formated exception Error Handling in WCF WebHttp Services with WebFaultException only xml formated exception json json

Error Handling in WCF WebHttp Services with WebFaultException only xml formated exception


I found the solution; faultExceptionEnabled needed to be false. Now I get the exception in json.


minor changes in Web.config service setup should work too: automaticFormatSelectionEnabled="false" defaultOutgoingResponseFormat="json"

<system.serviceModel><serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /><behaviors>  <serviceBehaviors>    <behavior>      <serviceMetadata httpGetEnabled="true" />      <serviceDebug includeExceptionDetailInFaults="true" />    </behavior>  </serviceBehaviors></behaviors><standardEndpoints>  <webHttpEndpoint>    <standardEndpoint name="" helpEnabled="true" faultExceptionEnabled="true" automaticFormatSelectionEnabled="false" defaultOutgoingResponseFormat="Json" />  </webHttpEndpoint></standardEndpoints>