In ASP.Net Application_Error avoid call to web service on the same web application.

In my ASP.NET application I had global event handler Application_Error, that called Web Service(via WS client proxy class) to log the error.
The actual web service ASMX file belongs to the same application.
I knew that it is better to call method directly, without extra layers, but function to call   Web Service were located in Business Layer DLL, that also was used by Desktop Client, so I  considered that it is acceptable overhead.

However, when an error occured on an early stage, when ASP.NET application is just started, this approach causes indefinite loop.
When the serious error occured, ASP.NET tries to report it and restart application. When during logging  Application_Error handler calls Web Service, it's considered as a new request to the application, it restarts, failed, calls to web service to log the error, and so on.
My error logging (based on User Friendly ASP.NET Exception Handling article) included sending e-mail alerts to administrator, and hundreds of e-mails were send over a minute -like Denial Of Service attack.


So I had to refactor my application avoid call to web service in Application_Error handler. 

 

posted @ Thursday, March 15, 2007 10:59 AM

Print

Comments on this entry:

# re: In ASP.Net Application_Error avoid call to web service on the same web application.

Left by Rachit at 3/15/2007 12:31 PM
Gravatar
:)
I just found that last week as well...I didnt' have sending email functionality so it took a while to find what was wrong.

Also, I noticed in case of error, sometimes (which I don't know why) if you try to use Request object, ASP.Net (1.1, on IIS6) doesn't like it. I still have to figure that out...very strange!

# re: In ASP.Net Application_Error avoid call to web service on the same web application.

Left by Michael Freidgeim at 3/16/2007 12:48 PM
Gravatar
Rachit,

Look at the "Rich Custom Error Handling with ASP.NET" article http://msdn2.microsoft.com/en-us/library/aa479319.aspx#customerrors_topic6.
It can give you some ideas, why context(e.g Request) can be not available.

Your comment:



 (will not be displayed)


 
 
 
Please add 1 and 1 and type the answer here:
 

Live Comment Preview:

 
«October»
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678