I had a situation where locally, calling an APIController method worked fine but when I uploaded the site to an Azure service, every time I called any method I would get back a 500 Internal Server Error. The project had a mix of standard MVC Controllers and APIControllers and the MVC Controllers worked fine but the APIControllers crashed every time. In an attempt to figure out what was going on, I logged into the remote server and checked the IIS logs but found nothing. I could see that 500 error being returned, but got nothing from the logs or the Event Viewer.
In a normal ASP.NET MVC project you could turn off custom errors through the web.config with something like this, but that did not provide any extra information.
<customErrors mode="Off" />
After some digging, I found out that in order to return more detailed error messages from an APIController, you have to set the following setting while the application starts. I dropped this in the Global.asax.cs Application_Start method and it provided the detailed error messages I needed.
GlobalConfiguration.Configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;