Why is ELMAH creating 2 reports for each error?

Posted by Chris F on Stack Overflow See other posts from Stack Overflow or by Chris F
Published on 2010-05-31T22:07:49Z Indexed on 2010/05/31 22:13 UTC
Read the original article Hit count: 551

Filed under:

I have setup ELMAH to create an XML log as well as send an email every time it encounters and unhandled exception in my ASP.NET MVC web application. However, creates 2 xml files for every error and sends to emails, seemingly identical each time. How do I stop this? My relevant web.config configuration sections are below. I thought the duplicate registration system.web and system.webServer may be causing the issue, but that's not the case.

<configSections>
    ...
    <sectionGroup name="elmah">
        <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
        <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
        <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
        <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
    </sectionGroup>
</configSections>

<elmah>
    <security allowRemoteAccess="no"></security>
    <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/Logs" />
    <errorMail from="[email protected]"
               to="[email protected]"
               cc="[email protected]"
               subject="ELMAH: Site Error"
               async="true"
               smtpPort="25"
               smtpServer="xx.xx.xx.xx" />
</elmah>

<system.web>
    ...
    <httpHandlers>
        ...
        <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
    </httpHandlers>
    <httpModules>
        ...
        <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
        <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
    </httpModules>
</system.web>

<!-- for IIS7 -->

<system.webServer>
    ...
    <modules runAllManagedModulesForAllRequests="true">
        ...
        <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
        <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>            
    </modules>
    <handlers>
        ...
        <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
    </handlers>
</system.webServer>

© Stack Overflow or respective owner

Related posts about elmah