在.NET Web应用程序的异常处理 [英] Exception Handling in .net web apps

查看:158
本文介绍了在.NET Web应用程序的异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我承认:我没有太多的异常处理麻烦。我知道我应该做的更多,但我不能换我周围哪里开始,在哪里停下头。我不是懒惰。离得很远。这是说我过度紧张与异常处理的矛盾心理。这似乎只是存在的,即使在最小的应用程序的地方看似无限多的可以应用异常处理,它可以开始觉得有点小题大做。

I admit it: I don't bother with too much exception handling. I know I should do more but I can never wrap my head around where to start and where to stop. I'm not being lazy. Far from it. It's that I'm overwrought with exception handling ambivalence. It just seems that there is a seemingly infinite number of places in even the smallest app where exception handling can be applied and it can begin to feel like overkill.

我已经通过仔细的测试,验证和默祷,但是这是一个不好的编程事故等待发生得到。

I've gotten by with careful testing, validating, and silent prayer but this is a bad programming accident waiting to happen.

那么,你有什么异常处理的最佳做法?特别是,在是应适用异常处理的最明显的/关键的地方和在哪里,它应该被视为地点?

So, what are your exception handling best practices? In particular, where are the most obvious/critical places where exception handling should be applied and where are places where it should be considered?

很抱歉的含糊不清的问题,但我真的要关闭这个一劳永逸的书。

Sorry for the vague the question but I really want to close the book on this once and for all.

推荐答案

微软模式&安培;实践小组做整合的异常管理的最佳做法纳入企业库一份好工作异常处理应用程序块

Microsoft's Patterns & Practices team did a good job incorporating best practices of exception management into Enterprise Library Exception Handling Application Block

事件,如果不使用企业库,我的的建议你阅读它们的文档。 P&安培; P组介绍了常见的方案和最佳实践的例外处理

Event if wouldn't use Enterprise Library, I highly recommend you to read their documentation. P&P team describes common scenarios and best practices for exceptions handling.

为您开始我推荐阅读以下文章:

To get you started I recommend read following articles:

  • Exception Handling on MSDN
  • Exception Management in .NET on MSDN
  • Exception Handling Best Practices in .NET on CodeProject

ASP.NET具体条款:

ASP.NET specific articles:

这篇关于在.NET Web应用程序的异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆