问题
I am working on an ASP.NET MVC 4 in C# project which works very well on my local development server. However, when I push it to my production server, a particular page gives a 500 internal server error. However, the error I get is no more helpful than "An error occurred while processing your request".
How can I force ASP.NET to display a more helpful error, even if it is the yellow screen of death?
Thank you for your time.
回答1:
Yes, there's a Yellow Screen of Death. You can force it to display the error by going to the Web.Config
file and making sure that you have this line:
<system.web>
<customErrors defaultRedirect="GenericError.htm"
mode="Off"></customErrors>
</system.web>
BUT be very careful NOT to leave it like this after you figure out the issue. It is BIG a security risk to display full stack traces of errors on a Production box.
来源:https://stackoverflow.com/questions/23297449/asp-net-mvc-error-500-when-pushed-to-production-server