为什么ASP.NET抛出这么多异常?
巧合我看了一下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会为您记录这些,以防万一你需要它们,但这并不意味着你必须对它们采取行动。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net – 未捕获错误:在初始化之前无法在弹出窗口上调用
- asp.net-mvc-routing – ASP.NET Web Api路由(IIS vs Self
- asp.net – 在新的MVC4应用程序中获取UserId(int)
- asp.net – 如何将razor变量作为参数传递给jquery函数
- asp.net – 在内联.aspx页面中导入错误
- ASP.NET Web API – 实体框架 – .Include上的500内部服务器
- 如何获取对默认ASP.NET页面处理程序或Web服务处理程序的引用
- 如果我在ASP.NET网页中打开数据库连接会发生什么
- asp.net – 在文本框中输入按键时避免发出哔声
- asp.net-core – asp.net核心依赖注入问题 – AddScoped没有
- asp.net – 在用户代码中未处理Assert faild异常
- asp.net – ResetPassword Token它存储的方式和位
- asp.net-mvc – 什么可以导致ViewData.ModelStat
- asp.net – TextBox在使用TextMode Number回发后
- ASP.NET MVC“Tidy”Html即时
- asp.net – MVC Controller返回Chunked内容编码
- asp.net-mvc – 什么是实例化和配置DbContext在M
- asp.net – asp .net mvc 4下拉列表
- 如何在ASP.NET核心rc2中禁用浏览器缓存?
- asp.net-mvc – POST操作方法中强类型的ViewMode