Подтвердить что ты не робот

Почему 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:\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
4b9b3361

Ответ 1

Я не уверен, что именно вызывает его, но я знаю, как вы можете узнать (еще лучше, правильно?:)).

В Visual Studio:

  • Нажмите "Отладка"
  • Нажмите "Исключения..."
  • Отметьте "Брошено" на "Исключения общего времени выполнения языка"

Это заставит Visual Studio остановить отладчик на любом исключении, чтобы вы могли проверить, что на самом деле происходит. (не влияет на производственный код, останавливается только в VS)

В качестве побочного элемента вы можете реализовать что-то вроде автоматическое исключение электронной почты или подобное, чтобы получить дополнительную информацию с производственного сайта.

Обратите внимание, что вы не сможете поймать все исключения из VS из коробки (исключение первого раза иногда может быть немного неуловимым). Если вы хотите быть более хардкорным, вы можете отключить отладчик Visual Studio отладить .Net Framework. Ваша цель должна состоять в том, чтобы увидеть полную исключение + трассировку стека, которая в большинстве случаев расскажет вам о том, что происходит не так.

Хорошая практика - избавиться от исключений (найти причину и исправить), не скрывать и не игнорировать их.

ИЗМЕНИТЬ

Также ничего не стоит, что " исключения первого шанса - это исключения, которые могут быть очень хорошо захвачены попыткой. Некоторые внутренние функции в .Net генерируют исключение, когда выполняется определенное условие, это часть работы Visual Studio/debugging и не означает, что что-то потерпело крах. Visual Studio будет записывать их для вас на случай, если они вам понадобятся, но это не значит, что вы должны действовать на них.

Ответ 2

Кто знает???

Но вы можете это выяснить. Хит ctrl-alt-E, а в диалоговом окне "Исключения" дать команду отладчику сломаться при вызове исключения:

exceptions dialog

Когда он сломается, проверьте свойство InnerException, чтобы узнать, что вызвало HttpException.

Ответ 3

Взгляните на этот URL-адрес, чтобы получить подробный обзор этих сообщений: http://blogs.msdn.com/b/davidklinems/archive/2005/07/12/438061.aspx.

Если вам нравится, вы можете отключить этот вывод, выбрав:

Инструменты → Параметры → Отладка → Общие → снимите флажок Перенаправить все текст окна вывода в окно немедленного доступа

Ответ 4

Дополнительная (возможно, полезная) информация:

Среди многих причин это может быть вызвано тем, что сайт /webapp не имеет файл favicon.ico.

Если фактическое исключение: System.Web.StaticFileHandler.GetFileInfo, очевидно, файл не найден. И если вы не видите фактическую ошибку 404 в браузере, вероятно, потому, что браузер спокойно занимается своим делом, когда он не находит favicon.ico.