Question

I have it all set up and I can browse to /elmah.axd but I have been causing all these errors and it won't log any of them, it just says 'no errors logged'... what the heck did I do wrong?

Here is the stuff I have added to my web.config:

<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" />     
  </sectionGroup>
</configSections>

<httpHandlers>
  <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>

<httpModules>
  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />  
</httpModules>

<elmah>
  <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
  <security allowRemoteAccess="yes" />
</elmah>

ALSO: This was already at the start of my RegisterRoutes()

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

I read that it doesn't matter any more with ASP.NET MVC 1.0 though, supposedly (per ELMAH website...)

Was it helpful?

Solution

The config seems to be in order; my best guess is that your IIS web application user doesn't have permission to write to App_Data. If you've locked down permissions, the application user will have read, but not write, permissions there.

You can open permissions up or log to another directory outside of the web path (which is a bit safer IMO) and make sure that read/write permissions for the user are set there.

OTHER TIPS

The Solution recipe

I installed from nuget elmah and elmah on XML log, didn't got the expected funcionality although I could access http://localhost/elmah.axd, but no error capturing.

I gave write permission to the account IIS_IUSERS in the folder APP_DATA and it started working for HTTP 404 errors and the errors that are outside MVC infrastructure. But it did not log exceptions inside the mvc. The solution was installing elmah.mvc package from nuget and it started capturing all exceptions.

If your config is OK, then just install the elmah.mvc package from nuget and it should start storing logs also inside mvc, not just HTTP 404.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top