ASP.NET MVC调试详细信息屏幕而不是404错误页面

rem*_*rem 1 deployment iis debugging asp.net-mvc

我已将ASP.NET MVC web.config设置更改为debug ="false":

<system.web>
    <compilation debug="false" targetFramework="4.0">
 .....
Run Code Online (Sandbox Code Playgroud)

但是在部署到服务器之后,如果输入错误的URL,我会得到一个带有异常详细信息和堆栈跟踪的服务器错误页面,而不是标准的404服务器错误页面.

关闭调试模式还省略了什么?

Dar*_*rov 5

您可以激活自定义错误:

<customErrors mode="On" defaultRedirect="/customerrors/500.aspx">
    <error statusCode="404" redirect="/customerrors/404.html" />
    <error statusCode="403" redirect="/customerrors/403.html" />
</customErrors>
Run Code Online (Sandbox Code Playgroud)