尝试在此处了解MVC管道:
似乎订单是这样的:
Controller.OnException何时相对于ExceptionFilterAttribute.OnException?
运行答案 0 :(得分:3)
它可能记录在某个地方,至少在源头,但我刚刚进行了这个小实验:
// in MyHandleErrorAttribute, globally configured
public override void OnException(ExceptionContext filterContext)
{
Debug.Print("HandleErrorAttribute.OnException 1");
base.OnException(filterContext);
Debug.Print("HandleErrorAttribute.OnException 2");
}
...
// in HomeController
protected override void OnException(ExceptionContext filterContext)
{
Debug.Print("Controller OnException 1");
base.OnException(filterContext);
Debug.Print("Controller OnException 2");
}
,输出窗口显示:
HandleErrorAttribute.OnException 1
HandleErrorAttribute.OnException 2
控制器OnException 1
Controller OnException 2