Question

I have created a Microsoft Web API with a number of controllers. On my local machine (Win 7, IIS Express) testing one of the controllers everything works fine. I can delete a "make" object with id 1 using the request localhostetc/makes/1. When I deploy to the server (W2K8, IIS7.5) I get a 500 error on the same request - see http://api.carsnow.ie/makes/1

My question is not what is causing the error, but what is the error? I can't see the details as I get a 0 length response. Earlier I was getting a custom error but at some stage when trying to see the underlying stack trace I lost even that.

So far I have tried the following....

I turned CustomErrors to "Off" in web.config

I added this code to WebAPIConfig.cs - http://lostechies.com/jimmybogard/2012/04/18/custom-errors-and-error-detail-policy-in-asp-net-web-api/

I added

GlobalConfiguration.Configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; 

to Global.asax

I turned on detailed errors in IIS7

Was it helpful?

Solution 2

I doubt this will work for everyone but in the end I was able to force the hand of IIS by deleting the setting for a 500 custom error pages in the "Error Pages" setting of the website in IIS. It appears that when it couldn't find the template for the custom error it spat out the real error.

OTHER TIPS

This article should help you:

In earlier versions of IIS, error messages from classic ASP scripts were sent to a Web browser, by default. Because these error messages might reveal sensitive information to malicious users, IIS 7 and above disables this feature by default. When your classic ASP scripts encounter an error in IIS, you receive the following error message by default:

An error occurred on the server when processing the URL. Please contact the system administrator.

If you are the system administrator please click here to find out more about this error.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top