1

Setup:

I have an ASP.NET MVC 4 app in a subfolder of the root folder (~/tracker).

I have ELMAH installed in the MVC app using NuGet.

Dev Machine:

On my dev machine the website is at the root. ELMAH works fine.

Problem on the Server:

On the server, I can see the ELMAH page, but despite generating errors, no errors get logged. It just says: "No errors found".

It also appears without any styling.

Web.config on Server:

The Elmah relevant bits on the server web.config are:

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>

appSettings:

<appSettings>
    <add key="elmah.mvc.disableHandler" value="false" />
    <add key="elmah.mvc.requiresAuthentication" value="true" />
    <add key="elmah.mvc.allowedRoles" value="Admin" />
    <add key="elmah.mvc.route" value="tracker/elmah" />
  </appSettings>

httpModules:

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

system.webServer:

<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
    </modules>
  </system.webServer>

Finally:

<elmah>
    <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data/Elmah" />
    <security allowRemoteAccess="yes" />
  </elmah>
awrigley
  • 13,481
  • 10
  • 83
  • 129

1 Answers1

1

ok, solved this one:

Add write permissions to the ~/App_Data/Elmah folder.

As the meerkat said, simples.

I solved it by finding the following SO answer:

Elmah.MVC does not log errors in production environment

There is also a guide for setting permissions on the ELMAH folder, or rather, a link to a guide in the accepted answer to that question.

What I can't get to work is the styling of the ELMAH pages. Any suggestions?

Community
  • 1
  • 1
awrigley
  • 13,481
  • 10
  • 83
  • 129