在Global.asax
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
throw new Exception("TEST");
}
// ... other usual methods
}
Elmah
没有记录异常。
我在这里做了很多初始化和配置工作,如果出现任何问题,我得到错误日志是很重要的。
不知道为什么它不起作用,但可能与 MVC 生命周期有关 - 也许HttpContext
现阶段没有?有没有办法通过Elmah
这里记录错误?