Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

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 on Thursday, March 15, 2007 10:59 AM ASP.NET | Back to top


Comments on this post: In ASP.Net Application_Error avoid call to web service on the same web application.

# re: In ASP.Net Application_Error avoid call to web service on the same web application.
Requesting 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!

Left by Rachit on Mar 15, 2007 12:31 PM

# re: In ASP.Net Application_Error avoid call to web service on the same web application.
Requesting 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.
Left by Michael Freidgeim on Mar 16, 2007 12:48 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net