ELMAH忽略MVC 3网站异常 [英] Elmah ignores exceptions in MVC 3 site

查看:107
本文介绍了ELMAH忽略MVC 3网站异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这是ELMAH或ASP.NET MVC3,或只是两者的结合问题:
我已经配置了我的MVC 3的网站使用ELMAH,但是当我使我的pretty错误页在web.config中,ELMAH停止记录异常。我曾经有过眼前这个在我的web.config,

I don’t know it this is an issue with ELMAH or ASP.NET MVC3, or just the combination of the two: I’ve configured my MVC 3 website to use ELMAH, but when I enable my "pretty" error page in web.config, ELMAH stops logging exceptions. I used to have just this in my web.config,

<customErrors mode="On" defaultRedirect="/Error.htm" redirectMode="ResponseRewrite"></customErrors>

不过,起初我并没有在我的共享文件夹中的Error.cshtml观点:ELMAH会记录异常失踪的错误观点,当一些其他异常被抛出。添加Error.cshtml视图之后,ELMAH不会记录任何异常了。

But at first I didn’t have an Error.cshtml view in my shared folder: ELMAH would log an exception for the missing Error view, when some other exception was thrown. After adding an Error.cshtml view, ELMAH doesn’t log any exceptions anymore.

我猜我需要配置MVC以不同的方式来处理异常,所以它们是由ELMAH回升,并最终ASP.NET踢,并显示错误.htm页。我怎么做?或者我使用MVC异常和/或ELMAH错了?

I’m guessing I need to configure MVC to handle exceptions in a different way, so they’re picked up by ELMAH, and the ASP.NET eventually kicks in and displays the error .htm page. How do I do that? Or am using MVC exceptions and/or ELMAH wrong?

推荐答案

看<一个href=\"http://stackoverflow.com/questions/766610/how-to-get-elmah-to-work-with-asp-net-mvc-handleerror-attribute/779961#779961\">this直接从ELMAH笔者回答。也有在同一个线程另一个答案应该给你另一种方法

Look at this answer directly from the author of Elmah. There is also another answer in the same thread that should give you an alternative approach

这篇关于ELMAH忽略MVC 3网站异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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