ExceptionContext.ExceptionHandled ändert sich in true. Wo wird die Ausnahme behandelt?

Ich verwende einen globalen Aktionsfilter, um alle Ausnahmen zu behandeln und zu protokollieren.

    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new ElmahHandleErrorAttribute());
        filters.Add(new HandleErrorAttribute());
    }

So funktioniert der globale AktionsfilterElmahHandleErrorAttribute ist definiert - es überschreibt dieOnException Methode.

public class ElmahHandleErrorAttribute : System.Web.Mvc.HandleErrorAttribute
{
    public override void OnException(ExceptionContext context)
    {
       //Is the exception handled already? context.ExceptionHandled seems to be true here
        if (!context.IsChildAction && (context.HttpContext.IsCustomErrorEnabled))
        {
            //Do other stuff stuff
            //Log to Elmah               
        }
    }
   ...
 }

Ich verstehe nicht, warum der Wert voncontext.ExceptionHandled ist wahr, wenn dieOnException Methode wird ausgeführt. Wie wird diese Ausnahme behandelt?

-BEARBEITEN- Ich habe eincustomErrors Abschnitt in derWeb.Config. ich habe einErrorController Klasse und Aktionen aufgerufenGeneral undHttp404.

<customErrors mode ="On" defaultRedirect="Error/General">
      <error statusCode="404" redirect="Error/Http404"/>
  </customErrors>

Was ich nicht verstehe, ist die Controller-AktionGeneral wird nicht ausgeführt (Haltepunkt wird nie erreicht), sondern der Wert vonExceptionContext.ExceptionHandled wird auf true gesetzt, wenn dasOnException Methode vonElmahHandleErrorAttribute startet die Ausführung.

Antworten auf die Frage(1)

Ihre Antwort auf die Frage