0

Elmah is logging errors properly to my database but I can't get to /elmah. What am I missing? This was working without ever implementing a controller for Elmah, but now it's not working. This is following a git merge. All configuration has been reset to how it was working before.

<system.web>
    <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>
        <add key="elmah.mvc.disableHandler" value="false" />
        <add key="elmah.mvc.disableHandleErrorFilter" value="false" />
        <add key="elmah.mvc.requiresAuthentication" value="false" />
        <add key="elmah.mvc.IgnoreDefaultRoute" value="false" />
        <add key="elmah.mvc.allowedRoles" value="*" />
        <add key="elmah.mvc.allowedUsers" value="admin" />
        <add key="elmah.mvc.route" value="elmah" />
    </appSettings>
    <httpModules>
        <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
        <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
        <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
    </httpModules>
</system.web>
<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>
<elmah>
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="[MyCSName]" />
</elmah>
</system.webServer>
joeldow
  • 1,048
  • 1
  • 9
  • 19
  • You should probably post your web.config and your packages.config. You might be missing the Elmah.Contrib.Mvc package? – ThomasArdal Jan 20 '14 at 20:34
  • I created a test project and added Elmah.MVC and it did not include Elmah.Contrib.Mvc. – joeldow Jan 21 '14 at 15:12
  • Ah sorry, that was the package I meant. Do you still have the elmah.mvc.route app setting in your web.config? – ThomasArdal Jan 22 '14 at 06:43
  • I've added my web.config elmah related details above. – joeldow Jan 22 '14 at 16:31
  • Weird. Looks almost exactly like mine. Only different is the elmah.mvc.allowedUsers app setting. What if you change the value to * ? – ThomasArdal Jan 22 '14 at 20:12
  • Tried that as well. The error is stored in the database, but the controller doesn't catch. – joeldow Jan 22 '14 at 23:14
  • Sounds like you may have something intercepting the call to /elmah before reaching ELMAH. Is it a regular 404 you get when requesting that URL? – ThomasArdal Jan 23 '14 at 06:19
  • I thought the same thing. Yes, the page is going to the default error page (). Elmah is recording the error in the database correctly, but I am not able to navigate to the Elmah UI. – joeldow Jan 23 '14 at 15:06
  • Does it tell you anything more if you disable custom errors? This should show you the standard ASP.NET error page, instead of the MVC one. Also did you try to ignore the route for elmah in your global.asax.cs: routes.IgnoreRoute("elmah"); – ThomasArdal Jan 24 '14 at 06:54
  • I get a 404 if I add an IgnoreRoute("elmah") in my RouteConfig.cs file. I get the same "Required dependency of type Elmah.Mvc.ElmahController could not be resolved." in the yellow error screen when I turn custom errors off. – joeldow Jan 24 '14 at 17:03
  • Does the references include the Elmah.Mvc.dll assembly? – ThomasArdal Jan 24 '14 at 18:04
  • Are you running servicestack or something other than pure MVC? I'm about to give up :) – ThomasArdal Jan 24 '14 at 18:54
  • Yes, service stack is included in the project but hasn't been tied in yet. – joeldow Jan 31 '14 at 20:36

3 Answers3

1

I realise this is an old question but it was the top google search result.

Another option if you want to continue using Funq is pass the additional assemblies you want scanned to funq. Change

new ServiceStack.Mvc.FunqControllerFactory(container);

To

new FunqControllerFactory(container, typeof(ElmahLogger).GetAssembly(), typeof(ElmahController).GetAssembly())

sl33kr
  • 51
  • 4
  • Will doing this still allow the auto-wired dependencies with servicestack, do you have a setup whereby you use servicestack authentication? – Darren Oct 06 '15 at 04:05
1

I am also using ServiceStack, this is what worked for me:

ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container, 
typeof (ElmahController).Assembly));
spinner_den_g
  • 941
  • 1
  • 8
  • 14
0

This most likely happens because you are using ServiceStack Funq IOC.

In App_Start\AppHost.cs (name may varies), try commenting out this line:

//Set MVC to use the same Funq IOC as ServiceStack
//ControllerBuilder.Current.SetControllerFactory(new ServiceStack.Mvc.FunqControllerFactory(container)); 

Regards.

Rosdi Kasim
  • 24,267
  • 23
  • 130
  • 154