加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

为什么ASP.NET抛出这么多异常?

发布时间:2020-12-15 18:47:36 所属栏目:asp.Net 来源:网络整理
导读:巧合我看了一下Visual Studio的调试输出。我可以看到数百和数以百计的异常被抛出。我检查了另一个基于ASP.NET的解决方案,并显示相同的行为。为什么抛出所有这些异常?我不敢相信它对整体表现有好处,是吗? 看下面的摘录。它是appr的输出。 30秒冲浪大多数
巧合我看了一下Visual Studio的调试输出。我可以看到数百和数以百计的异常被抛出。我检查了另一个基于ASP.NET的解决方案,并显示相同的行为。为什么抛出所有这些异常?我不敢相信它对整体表现有好处,是吗?
看下面的摘录。它是appr的输出。 30秒冲浪大多数是HttpExceptions,但也有FormatExceptions和ArgumentOutOfRangeExceptions。这些都没有真正影响使用。没有什么崩溃有人有解释,因为它似乎是“正常”?
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
'w3wp.exe' (Managed): Loaded 'C:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Filesroota402e511e6aaa0deApp_Web_vdj_eurz.dll',Symbols loaded.
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.InvalidCastException' occurred in mscorlib.dll
A first chance exception of type 'System.InvalidCastException' occurred in mscorlib.dll
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll

解决方法

我不知道究竟是什么导致的,但我知道你如何找到(更好,对… :))。

在Visual Studio中:

>点击“调试”菜单
>点击“例外…”
>检查“通用语言运行时异常”中的“抛出”

这将使Visual Studio在任何异常情况下停止调试器,以便您可以检查实际发生的情况。 (不影响生产代码,只在VS中暂停)

作为旁注,您可能希望实现像automatic exception emailing或类似的东西,以从生产站点获取更多信息。

请注意,您可能无法在VS中捕获所有异常(第一次异常有时可能无法实现)。如果你想要更核心,你也可以使用Visual Studio调试器debug the .Net Framework。您的目标应该是查看完整的异常堆栈跟踪,这在大多数情况下会告诉您所有的错误。

一个好的做法是摆脱异常(找到原因和修复),不要隐藏或忽略它们。

编辑

“first chance exceptions”也是一个很好的例子,它可以很好地被一个try-catch捕获。当某个条件满足时,.Net中的一些内部函数将抛出异常,这是Visual Studio /调试工作的一部分,并不意味着某些事情已经崩溃。 Visual Studio会为您记录这些,以防万一你需要它们,但这并不意味着你必须对它们采取行动。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读