title: Custom JSON IErrorHandler in WCF returning StatusCode 200/504 when should return 400
body: <p>I have a WCF service that among other bindings also uses WebHttpBinding for JSON inputs/results.</p>
  
  <p>I made a custom IErrorHandler implementation in order to be able to set the StatusCode to 400 when something goes wrong and also return a JSON understandable message. It´s the straight implementation that you can find everywhere (nice way described <a href="https://stackoverflow.com/questions/1272877/returning-error-details-from-ajax-enabled-wcf-service">here</a>). </p>
  
  <p>My problem is: when I test it locally using Visual Studio Web Development Server (Cassini) it works perfectly. However, when I deploy it to my test server (Windows 2008 with standard config for IIS and everything else) it does not work.</p>
  
  <p>When I call it and debug with Firebug I get a HttpStatusCode 200 as a return and no response text. With Fiddler I get a HttpStatusCode 504 and no return at all. However, the behavior I expected (and what happens locally) is a call to the error callback of the ajax call with the responseText set.</p>
  
  <p>I debugged it remotely and everything looks just fine. The execution pipeline is OK and all the classes are called as they should be just like they are locally, except it does not work.</p>
  
  <p>Any suggestions? I´m pretty much out of options here to figure this out.</p>
  
  <p>Thanks a lot!</p>