Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么ASP.NET会抛出这么多异常?_Asp.net_Iis - Fatal编程技术网

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

为什么ASP.NET会抛出这么多异常?,asp.net,iis,Asp.net,Iis,巧合的是,我看了一下VisualStudio的调试输出。我可以看到成百上千的各种异常被抛出。我检查了另一个基于ASP.NET的解决方案,它显示了相同的行为。为什么会抛出所有这些异常?我不敢相信这对整体表现有好处,是吗? 请看下面的摘录。它是appr的输出。30秒冲浪。大多数是HttpException,但也有FormatException和ArgumentOutofRangeException。这些都不会真正影响使用。没有崩溃。有人有解释吗,因为这似乎是“正常的” 请查看此URL以了解这些消息的

巧合的是,我看了一下VisualStudio的调试输出。我可以看到成百上千的各种异常被抛出。我检查了另一个基于ASP.NET的解决方案,它显示了相同的行为。为什么会抛出所有这些异常?我不敢相信这对整体表现有好处,是吗? 请看下面的摘录。它是appr的输出。30秒冲浪。大多数是HttpException,但也有FormatException和ArgumentOutofRangeException。这些都不会真正影响使用。没有崩溃。有人有解释吗,因为这似乎是“正常的”


请查看此URL以了解这些消息的详细信息:

如果愿意,可以通过转到以下位置禁用此输出:


工具-->选项-->调试-->常规-->取消选中将所有输出窗口文本重定向到即时窗口

我不确定确切的原因,但我知道如何找到(更好,对吧?:)

在Visual Studio中:

  • 点击“调试”菜单
  • 点击“例外…”
  • 选中“公共语言运行时异常”上的“抛出”
这将使VisualStudio在出现任何异常时暂停调试器,以便您可以检查实际发生的情况。(不影响生产代码,仅在VS中暂停)

作为旁注,您可能希望实现类似或类似的功能,以便从生产站点获取更多信息

请注意,您可能无法捕获VS开箱即用中的所有异常(第一次异常有时可能有点难以捉摸)。如果你想变得更硬核,你也可以使用VisualStudio调试器。您的目标应该是查看完整的异常+堆栈跟踪,在大多数情况下,这将告诉您出了什么问题

一个好的做法是消除异常(查找原因并修复),不要隐藏或忽略它们

编辑

“是很可能被try-catch捕获的异常,这也毫无价值。Net中的某些内部函数在满足特定条件时会引发异常,这是Visual Studio/调试工作方式的一部分,并不意味着某些东西已崩溃。VisualStudio将为您记录这些信息,以备您需要,但这并不意味着您必须根据它们采取行动。

谁知道呢

但是你会发现的。点击ctrl-alt-E,并在异常对话框中指示调试器在引发异常时中断:

当HttpException中断时,请检查属性以查看导致HttpException的原因。

其他(可能有用)信息:

在众多原因中,这可能是由于站点/webapp没有favicon.ico文件造成的


如果实际的异常是:System.Web.StaticFileHandler.GetFileInfo,则显然找不到该文件。如果你没有在浏览器上看到实际的404错误,很可能是因为浏览器在找不到favicon.ico的情况下悄悄地开始工作。

如果你重建网站,它能工作吗?不,我是说,一切都能工作。我只是想知道这些例外意味着什么。我看到你接受了答案。我仍然很好奇:这种行为到底是正常的还是你的代码导致的?是的,是我的代码导致的。这是关于所有那些你最终在大型项目中遇到的小麻烦。我可以通过简单地添加空检查而不是try-catch来修复其中的一些问题。其他人正在按预期工作,例如,当尝试使用反射重新连接事件处理程序时。故事的寓意是摆脱那些try/catch块,以便您可以快速找出代码中的错误并加以修复。啊哈。所以这告诉我这不是一个问题,异常会以某种方式得到处理。但它确实表明System.Web.dll和mscorlib.dll内部出现了问题?那么,这种行为正常吗?甚至是超出范围的争论?正在捕获基于异常的控制流的ArgumentOutOfRange气味。。。他们在mscorlib中使用吗?哎哟@Krumelur你确定你自己没有捕捉到这些异常吗?是的,第一次机会异常是被抛出并处理的异常。时间为46秒大概是我拍快照的时间。谢谢!我能找出是什么引起了他们。不幸的是,HtppExceptions已经停止。我去看看他们是否回来。谢谢。现在我知道了:“提供程序与Oracle客户端版本不兼容”。VS2013在我选中“CLRE”之前什么也没做。在VS2015中:单击“调试”菜单、子菜单窗口、项目异常设置(快捷键Ctrl-Alt-E),以获取一组可以检查的异常。
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:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a402e511\e6aaa0de\App_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