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.