如果MVC后加入IApplicationBuilder开发异常页面是空白 [英] Developer Exception Page is blank if added to IApplicationBuilder after MVC
问题描述
开发异常页面( app.UseDeveloperExceptionPage()
)如果MVC(后加入 IApplicationBuilder
空白 app.UseMvc()
Startup.cs )>配置
方法。
Developer Exception Page (app.UseDeveloperExceptionPage()
) is blank if added to IApplicationBuilder
after MVC (app.UseMvc()
) in Startup.cs
Configure
method.
后添加的,如果加入开发者异常页面正常工作前MVC。
Developer Exception Page works fine if added before MVC.
这种行为是有意的还是我做错了什么?
Is this behavior intentional or am doing something wrong?
- Visual Studio代码0.10.6在Mac
- Microsoft.AspNet.Diagnostics 1.0.0-RC1决赛
- Microsoft.AspNet.Mvc 6.0的3.0 RC1决赛
- DNX单1.0.0-RC1-UPDATE1
- Visual Studio Code 0.10.6 on Mac
- Microsoft.AspNet.Diagnostics 1.0.0-rc1-final
- Microsoft.AspNet.Mvc 6.0.0-rc1-final
- DNX Mono 1.0.0-rc1-update1
推荐答案
您所看到的行为 TOTALLY故意:在ASP.NET 5,中间件在他们注册的相同顺序执行
The behavior you're seeing is TOTALLY intentional: in ASP.NET 5, middleware are executed in the same order as they are registered.
在注册后MVC开发异常页面中间件,它没有机会赶上你的控制器动作抛出的异常(如它甚至没有调用)。唯一的例外是这样服务器(红隼),返回一个500响应截获,这就是为什么你看到一个空白页。
When registering the developer exception page middleware after MVC, it has no chance to catch the exception thrown by your controller action (as it's not even invoked). The exception is thus intercepted by the server (Kestrel), that returns a 500 response, and that's why you see a "blank page".
这篇关于如果MVC后加入IApplicationBuilder开发异常页面是空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!