ELMAH does not use exceptions in the static page method

I was looking for a way to log unhandled exceptions that occur in asp.net static methods (which are called via javascript from a browser).

This question led me to configure ELMAH, but unfortunately I returned to square because he does not understand these exceptions. (however, it works great for exceptions with a regular page loop).

I tried adding the MsAjaxDeltaErrorLog http module, but this has no effect (I use .NET 3.5 anyway).

Is it possible for these errors to be logged without wrapping each method in try / catch?

+4
source share
1 answer

Web method errors are not handled by the global asax error event. You have to manually manually them,

 try { some web method code } catch(Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } 

ref: How to use ELMAH for manual error reporting?

+2
source

Source: https://habr.com/ru/post/1339511/


All Articles