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>
有帮助吗?

解决方案 3

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.

其他提示

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())

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

ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container, 
typeof (ElmahController).Assembly));
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top