When email notification is not working in ELMAH

Hopefully you've heard of ELMAH, (Error Logging Modules and Handlers) if you're doing ASP.NET work. This gem is priceless when trying to catch unhandled exceptions in your project.

I ran into an issue today when following the web.config guidelines in the elmah release (it contains a sample web.config with documentation for all the configuration).  I wanted to be emailed whenever an exception occurred on the site, so I put the appropriate settings into the errorMail element in the <elmah /> configuration.  I setup some test exceptions to make sure that ELMAH was working correctly, and could see the errors in elmah.axd, but the emails were not being sent.

It turns out that the modules registered under <system.webServer> <modules> need to be included in <system.web> <httpModules> as well:

<system.web>
<httpModules>
    <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
    <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"  />
</httpModules>
</system.web>

The example web.config mentions having to put these modules in additional modules in httpModules if mail reporting is desired, but since it was commented out in the example, I accidentally skipped over it.  After this change was made, the email notifications started coming through.  Hopefully this will help me remember in the future, or help someone who is having the same issue.


Posted by: Jeff
Posted on: 1/16/2010 at 12:13 AM
Categories: elmah
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading