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>