Search code examples
elmahelmah.mvc

Required dependency of type Elmah.Mvc.ElmahController could not be resolved


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>

Solution

  • 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.