http://blogs.msdn.com/b/webdev/archive/2013/11/22/debugging-owin-app-or-framework.aspx에서 데모 코드를 얻었습니다. 그리고 그것은 섹시한 오류 페이지를 보여줍니다.어떤 종류의 예외가 Microsoft.Owin.Diagnostics.ErrorPageExtensions.UserErrorPage에 의해 잡힐 것입니까
app.UseErrorPage(new ErrorPageOptions()
{
//Shows the OWIN environment dictionary keys and values. This detail is enabled by default if you are running your app from VS unless disabled in code.
ShowEnvironment = true,
//Hides cookie details
ShowCookies = false,
//Shows the lines of code throwing this exception. This detail is enabled by default if you are running your app from VS unless disabled in code.
ShowSourceCode = true,
});
app.Run(async context =>
{
throw new Exception("UseErrorPage() demo");
await context.Response.WriteAsync("Error page demo");
});
}
그러나 컨트롤러 작업에서 예외가 발생하면 오류 페이지가 표시되지 않고 여전히 YSOD가 표시됩니다.
그래서 UseErrorPage에서 어떤 예외가 잡히게되는지 알고 싶습니까? 작동하려면 추가 구성이 필요합니까?
웹 API는 예외를 처리하고 UseErroPage 미들웨어가 처리하기 전에 500 응답으로 변환하는 것처럼 보입니다. 일반적으로 파이프 라인의 처리되지 않은 응답은 UseErrorPage 미들웨어에 의해 처리됩니다. – Praburaj