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

在 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'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值