Pourquoi est ASP.NET autant d'exceptions?

par coïncidence j'ai regardé un peu la sortie de débogage de Visual Studio. Je peux voir des centaines et des centaines de différents exception levée. J'en ai vérifié un autre. ASP.NET solution basée et elle montre le même comportement. Pourquoi toutes ces exceptions jetés? Je ne peux pas croire que c'est bon pour la performance globale, est-il? Regardez l'extrait ci-dessous. C'est la sortie de rapp. 30 secondes de surf. La plupart sont des exceptions Httpex, mais il y a aussi des exceptions de formatage et des arguments hors exceptions. Aucun des ces est vraiment touchant l'utilisation. Rien ne se bloque. Quelqu'un at-il une explication, car il semble être "normal"?

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
25
demandé sur Krumelur 2011-03-30 18:31:23

4 réponses

Je ne sais pas exactement ce qui cause cela, mais je sais comment vous pouvez le découvrir (encore mieux, Non?:)).

Dans Visual Studio:

  • cliquez sur" Déboguer " menu
  • cliquez sur " Exceptions..."
  • cochez "Thrown" sur "Common Language Runtime Exceptions"

cela fera que Visual Studio arrêtera le débogueur sur n'importe quelle exception pour que vous puissiez vérifier ce qui se passe réellement. (n'affecte pas la production de code, uniquement s'arrête dans VS)

en tant que sidenote vous pouvez vouloir implémenter quelque chose comme email d'exception automatique ou similaire pour obtenir plus d'informations d'un site de production.

notez qu'il est possible que vous ne puissiez pas saisir toutes les exceptions dans VS out of the box (les premières exceptions peuvent parfois être un peu insaisissables). Si vous voulez être plus hardcore vous pouvez avoir Visual Studio debugger déboguer l' .Net Framework trop. Votre objectif devrait être de voir l'exception complète + pile trace, qui dans la plupart des cas vous dira tout sur ce qui va mal.

une bonne pratique est de se débarrasser des exceptions (trouver la cause et corriger), ne pas les cacher ou les ignorer.

EDIT

cela ne vaut rien non plus que " exceptions de la première chance " sont des exceptions qui peuvent très bien être capturées par un try-catch. Certaines fonctions internes dans .Net va jeter une exception quand une certaine condition est respectée, Cela fait partie de la façon dont visuel Studio / débogage fonctionne et ne signifie pas que quelque chose s'est écrasé. Visual Studio enregistrera ces fichiers pour vous juste au cas où vous en auriez besoin, mais cela ne signifie pas que vous devez agir sur eux.

35
répondu Tedd Hansen 2015-01-09 11:25:26

Qui sait???

Mais vous pouvez trouver. Appuyez sur Ctrl-alt-E, et dans la boîte de dialogue Exceptions, donnez l'instruction au débogueur de casser lorsque l'exception est lancée:

exceptions dialog

quand il casse, cochez la case InnerException propriété pour voir ce qui a causé la HttpException.

22
répondu Will 2011-03-30 14:38:03

jetez un coup d'oeil à cette URL pour un regard détaillé sur ces messages:http://blogs.msdn.com/b/davidklinems/archive/2005/07/12/438061.aspx.

Si vous le souhaitez, vous pouvez désactiver cette sortie en allant à:

Outils --> Options --> Débogage --> Général --> décocher la case rediriger tout le texte de la fenêtre de sortie vers la fenêtre immédiate

4
répondu NakedBrunch 2011-03-30 14:33:58

Supplémentaires (peut-être utile) info:

parmi de nombreuses raisons, cela pourrait être causé par le site/webapp n'ayant pas de favicon.fichier ico.

si l'exception réelle est: système.Web.StaticFileHandler.GetFileInfo c'est évidemment un fichier introuvable. Et si vous ne voyez pas l'erreur 404 réelle sur le navigateur, c'est probablement parce que le navigateur se déplace tranquillement ses affaires quand il ne trouve pas favicon.ico.

2
répondu MandoMando 2011-11-02 17:26:36