.net网络应用程序中的异常处理 [英] Exception Handling in .net web apps

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

问题描述

我承认:我并不打扰太多异常处理。我知道我应该做更多的事情,但是我永远不能把头靠在哪里开始,哪里停下来。我没有懒惰离得很远。这是我异常处理矛盾的过程。只是似乎有一个似乎无限数量的地方,即使是最小的应用程序,异常处理可以应用,它可以开始感觉像过度杀伤。



我有得到了仔细的测试,验证和沉默的祷告,但这是一个糟糕的编程事故等待发生。



那么,你的异常处理最佳实践是什么?特别是应该应用异常处理的最明显/关键的地方在哪里,哪里应该考虑哪些地方?



抱歉,这个问题是模糊的,但是真的想一下子关闭这本书。

解决方案

Microsoft的 Patterns&实践团队将异常管理的最佳做法纳入企业库异常处理应用程序块



事件如果不使用企业库,我高度建议您阅读他们的文档。 P& P小组介绍了异常处理的常见情况和最佳做法。



为了让您开始,我建议您阅读以下文章:





ASP.NET具体文章:




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

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:

ASP.NET specific articles:

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

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