4

ASP.NET ASMX service occasionally throws exceptions. However, global.asax Application_Error method do not seem to catch them. The question is, how to configure global error handler to catch and log these exceptions?

4

3 回答 3

2

ASMX Web 服务的基本问题(这不是问题)是服务层后面的任何异常都会作为 SOAP 异常抛出给客户端。您需要捕获 SOAP 异常,然后在那里寻找内部异常。

更好更干净的方法是在应用程序中实现 SOAP 处理程序。通过此序列化 SOAP 异常并在客户端反序列化它。这样,您将完全控制异常流,而不是 .net 框架。

高温高压

于 2008-11-19T18:29:59.813 回答
0

Is it the ASMX or the AJAX JavaScript which is throwing the exception?

If it's the Javascript, you'll need to write exception handling into your JS, and then push that back to the server to be tracked in your error datastore--possibly via another call to your webservice.

If it's the ASMX then it's probably getting caught by your Application_Error, BUT as ASMX returns XML or JSON it won't necessarily get displayed on your UI unless you're looking for it.

于 2008-10-14T13:19:19.133 回答
0

Client-side I Would simply wrap your call to the service in a JavaScript. On the server-side the error should be logged in your server log as an. http 500 error

于 2008-10-14T13:23:31.573 回答