IIS 7.0不显示自定义错误页 [英] IIS 7.0 doesn't display custom error pages

查看:116
本文介绍了IIS 7.0不显示自定义错误页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行,有它自己的错误处理程序的应用程序。错误页面正常显示,而在开发环境测试(正确显示的错误页)。

但是在生产IIS一样code,错误页面被替换。
问题描述 href=\"http://www.west-wind.com/weblog/posts/745738.aspx\">。

I'm running an application that has its own error handlers. Error pages are displayed properly while testing in dev environment (error pages are displayed properly).
However the same code on the production IIS, error pages are substituted. The problem is described here.

我不知道有没有写,而不是修改code在web.config文件中设置这样的方式。

I just wonder is there a way to write this settings in web.config file instead of modifying the code.

推荐答案

敬畏是对的(+1),但另外:IIS 7已经在博客中描述的特殊处理您链接和<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.htt$p$psponse.tryskipiiscustomerrors.aspx?ppud=4\">this MSDN文章。如果你在你的行动使用HandleErrorAttribute,这已经为你做。如果没有,你需要设置:

Awe is right (+1), but in addition: IIS 7 has special handling described in the blog post you linked and this MSDN article. If you are using HandleErrorAttribute on your action, this is already done for you. If not, you'll need to set:

filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;

...你自己。

...yourself.

这篇关于IIS 7.0不显示自定义错误页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆