An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.

I was playing with Elmah. I had turned on customErrors in the web.config and set redirect to an custom error page.

<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
    
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah.Sql" />

I tried xml file logging and it worked fine. Then I added sql logging and started getting the following error:

Runtime Error

Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.

I got this error when trying to use ELMAH logging framework.

Due to customError="On", it was kind of going into an error loop.

As soon as I turned set customErrors="Off", it started giving me regular asp.net error page with the exact problem.

The problem was I had two <elmah> loggers in the web.config and it didn't like it.

Removing the xml logger, sql logging started working.

<!--<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />-->
    
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah.Sql" />

Hope this helps.

233 Comments

Add a Comment

As it will appear on the website

Not displayed

Your website