C#.NET Web应用程序中的异常管理 [英] Exception Management in C# .NET Web Application

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

问题描述



我有一个实现MVC架构的C#.NET WebApplication.
我需要对我的应用程序实施异常处理.
我已经包括了尝试捕获块和一些异常消息,但我认为这还不够.
谁能建议实现异常处理的最佳方法?
如果必须记录我的错误,最好的方法是什么?

谢谢!

Hi,

I have a C#.NET WebApplication which implements MVC Architecture.
I need to implement Exception Handling to my application.
I have included Try Catch Blocks and few Exception Messages , but I dont think that is sufficient .
Can anyone suggest best way to implement exception handling?
If I have to log my error what is the best approach?

Thanks!

推荐答案

Appi9写道:

我包括了Try Catch Blocks和一些异常消息,但我认为这不够.

I have included Try Catch Blocks and few Exception Messages , but I dont think that is sufficient .



为什么您认为这还不够?

在用户界面中,对于每个事件,请使用try catch块,如果发生任何异常,
然后显示您的异常消息.
除了UI,不要在其他层中使用try catch块.



Why do you think it is not sufficient?

In UI, on every event use try catch block, and if any exception occurs,
then show your exception message.
Dont use try catch block in other layers except UI..


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

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