.net网络应用程序中的异常处理 [英] Exception Handling in .net web apps
问题描述
我有得到了仔细的测试,验证和沉默的祷告,但这是一个糟糕的编程事故等待发生。
那么,你的异常处理最佳实践是什么?特别是应该应用异常处理的最明显/关键的地方在哪里,哪里应该考虑哪些地方?
抱歉,这个问题是模糊的,但是真的想一下子关闭这本书。
Microsoft的 Patterns&实践团队将异常管理的最佳做法纳入企业库异常处理应用程序块
事件如果不使用企业库,我高度建议您阅读他们的文档。 P& P小组介绍了异常处理的常见情况和最佳做法。
为了让您开始,我建议您阅读以下文章:
- 异常处理 MSDN
- .NET中的异常管理在MSDN上
- 异常处理最佳做法在.NET 6.0中的CodeProject
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:
- Exception Handling on MSDN
- Exception Management in .NET on MSDN
- Exception Handling Best Practices in .NET on CodeProject
ASP.NET specific articles:
- User Friendly ASP.NET Exception Handling
- Global Exception Handling with ASP.NET
- Exception handling in C# and ASP .Net
这篇关于.net网络应用程序中的异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!