Iis – How to return custom content with an error response in IIS 7

iisiis-7jsonweb services

My API returns JSON content with some errors, such as 500 (Bad Request). Under IIS 6, this worked fine. In IIS 7, once I turn off detailed error messages it simply returns the text "Bad Request". How can I keep the contents of my response intact?

Best Answer

You need to set the Error Responses to 'Detailed errors' in the Error Pages setting of IIS7. Open that, then click on 'Edit Feature Settings', you'll find it there.