VS 2017 ASP.Net项目在浏览器窗口中未显示错误 [英] VS 2017 ASP.Net project doesn't show errors in browser window

查看:47
本文介绍了VS 2017 ASP.Net项目在浏览器窗口中未显示错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio 2017社区版中使用asp.net开发一个迷你项目.

I'm developing a mini project using asp.net in visual studio 2017 community edition.

当我的代码中有错误时,浏览器窗口不会显示什么错误.它仅显示空白页.由于我是使用asp.net进行Web开发的新手,因此调试代码非常困难.

When there is an error in my code, browser window doesn't show what are the errors. It only shows a blank page. Since I'm new to web development using asp.net, this makes it very difficult to debug the code.

我已经看到很多开发人员建议编辑web.config页面.但是,VS2017中没有web.config页面.

I've seen lot of developers have suggested to edit the web.config page. However there is no web.config page in VS2017.

有人可以帮我解决这个问题吗?

Can anyone help me to solve this?

推荐答案

在配置中间件时,语句顺序很重要.尝试将 app.UseMvc()放在异常块之后.

While configuring middleware, sequence of statements matter. Try putting app.UseMvc() after Exception blocks.

您可以尝试使用错误页面来显示不同的状态代码,这可能会对您有所帮助. https://github.com/aspnet/Diagnostics/blob/dev/src/Microsoft.AspNetCore.Diagnostics/StatusCodePage/StatusCodePagesExtensions.cs

You can try error pages for different status codes, this may help you. https://github.com/aspnet/Diagnostics/blob/dev/src/Microsoft.AspNetCore.Diagnostics/StatusCodePage/StatusCodePagesExtensions.cs

这篇关于VS 2017 ASP.Net项目在浏览器窗口中未显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆