服务器端ASP.Net Ajax的异常处理 [英] Server-side ASP.Net Ajax exception handling

查看:120
本文介绍了服务器端ASP.Net Ajax的异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.net的AJAX框架,我试图做的JavaScript所谓的web服务的一些异常日志记录。

I am using ASP.net's AJAX framework and I am trying to do some exception logging on the javascript-called webservice.

看,我发现一些人的处理它们的客户端,并送他们回服务器。我想preFER没有这样做,因为它依赖于其他的服务器通话(如果它失败的第一次,发送一个请求,其他看起来并不像一个好主意,这让我改变我的所有来电)

Looking through the web, I find some people handling them client-side and sending them back to the server. I'd prefer not doing that since it relies on an other server call (if it failed the first time, sending an other request doesn't look like a good idea and that makes me change all my calls)

我看到一些其他人<一个href=\"http://www.eggheadcafe.com/tutorials/aspnet/af62d138-fa2f-491e-901f-d36a82f107e8/net-web-services--excep.aspx\">decorating他们所有的方法,提供的try ... catch块(这会导致重复的错误处理,但一个其他try catch块)。

I see some other people decorating all their methods with try... catch blocks (which leads to duplicate error handling, and yet an other try catch block).

不过,我想实现类似于Global.asax中的东西的Application_Error()它处理每一个未捕获的异常(不,它似乎并没有被要求AJAX调用的方法例外)。

However, I'm trying to achieve something similar to global.asax's Application_Error() which handles every uncaught exception (nope, it doesn't seem to be called for AJAX called methods exceptions).

是,即使可能吗?

推荐答案

使用 ELMAH - 它可以捕捉阿贾克斯错误。

Use ELMAH - it can capture ajax errors.

这篇关于服务器端ASP.Net Ajax的异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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