I have a Web API controller POST method that behaves fine locally and on the testing server. If everything goes well it returns:
new HttpResponseMessage( HttpStatusCode.Created )
If something goes wrong, it returns:
new HttpResponseMessage<IEnumerable<string>>( usefulMessages, HttpStatusCode.BadRequest );
The problem is that when I make a request to the testing server that results in an error, I get the bad request code back but I never see the messages. If I make the exact same request to my local machine, I do see the messages. The following outputs are from my own tool:
Sending a request to my local machine I get:
Status code: 400 (BadRequest)
Response data: ["Error message one", "Error message two"]
Sending a request to the testing server I get:
Status code: 400 (BadRequest)
Response data: Bad Request
The code that is running is exactly the same. The database is the same. Everything is the same except for the server servicing the request. I even have code to email myself the error messages so I know that the server is producing the correct error messages and behaving correctly. Could this be an IIS thing (like the equivalent of customErrors = RemoteOnly for Web API)? Not only are the error messages omitted from the response data, something invents the phrase "Bad Request" to put in there instead.
Any ideas? Thanks.