开发者

MVC 3- Error Handling

开发者 https://www.devze.com 2023-03-17 20:31 出处:网络
I am trying to 开发者_如何学Cuse Elmah for handling errors in my applications with VS 2010 and MVC 3.

I am trying to 开发者_如何学Cuse Elmah for handling errors in my applications with VS 2010 and MVC 3.

Did anyone used it before, could you kindly guide me the various steps involved for using it in VS 2010.

Basically how to set it up?

Thank you


Scott hanselman has something on this. The good news is that its so simple to get up and running you shouldn't need much guidance. Use nuget to install the package (it'll set up everything in the web.config correctly) and it'll start logging errors.

The only thing I think worth mentioning is if you want to catch an error but log it too then use:

try
{
    ....
}
catch (Exception ex)
{
    Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
}

Martin

0

精彩评论

暂无评论...
验证码 换一张
取 消