首页 > Web开发 > 详细

在ASP.NET 5中显示错误信息

时间:2015-06-28 16:46:43      阅读:316      评论:0      收藏:0      [点我收藏+]

在 ASP.NET 5 中如果不进行显示错误信息的相关配置,在发生错误时,在浏览器中只能看到空白页面。

显示错误信息的配置方法如下:

1)在 project.json 中添加对 Microsoft.AspNet.Diagnostics 的引用

{
    "dependencies":{
        "Microsoft.AspNet.Diagnostics": "1.0.0-*"
    }
}

2)在 Startup.cs 中添加 app.UseErrorPage() 

public class Startup
{
    public void Configure(IApplicationBuilder app)
    {
        app.UseErrorPage();
    }
}

错误信息显示页面示例:

An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.

/Views/Shared/_Layout.cshtml

‘IHtmlHelper<dynamic>‘ does not contain a definition for ‘TabLink‘ and the best extension method overload ‘HtmlHelperExtensions.TabLink(HtmlHelper, string, string, string)‘ requires a receiver of type ‘HtmlHelper‘

在ASP.NET 5中显示错误信息

原文:http://www.cnblogs.com/dudu/p/4605639.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!