为什么ASP.NET抛出这么多异常?
|
巧合我看了一下Visual Studio的调试输出。我可以看到数百和数以百计的异常被抛出。我检查了另一个基于ASP.NET的解决方案,并显示相同的行为。为什么抛出所有这些异常?我不敢相信它对整体表现有好处,是吗?
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会为您记录这些,以防万一你需要它们,但这并不意味着你必须对它们采取行动。 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net – 如何绑定DropDownList的选定值
- asp.net mvc和css:选择时突出显示菜单选项卡
- asp.net-mvc – 使用Razor的ASP.NET MVC 3 – 将条件表达式
- asp.net-mvc – 在ASP.NET MVC应用程序中记录用户活动
- asp.net-mvc – webgrid中的Mvc 3 texbox(razor)
- asp.net-mvc – 如何修复错误名称空间’System’中不存在类
- asp.net-mvc – 我可以从动作过滤器返回动作结果吗?
- asp.net – 在IIS中有类似cron作业的东西吗?
- ASP.NET Hang – 通用字典并发问题导致GC死锁
- asp.net-core – ASP.Net核心maxUrlLength
- ASP.NET MVC 3中的当前年份
- 如何在两个不同的文件夹中应用asp.net授权?
- asp.net – 可以通过移动设备的Web浏览器上传图片
- asp.net-mvc – 在ASP.NET MVC 3中的子文件夹中添
- asp.net FileUpload.FileName返回完整路径,即ie,
- asp.net-mvc – MVC2中的REQUIRED String属性的服
- asp.net – Response.Write和UpdatePanel
- 如何使用代码隐藏技术在asp.net中获取当前页面的
- asp.net-core-mvc – 在EF7中加载引用
- ASP.NET MVC – 使用模型中的布尔值禁用Html帮助
