Question

So, I don't know if anyone else is experiencing this but if I run an asp.net website with ELMAH installed through IIS 7.5 Express, ELMAH refuses to log or even read from the database. If I instead run the website through Cassini, all is well. Elmah works like a charm...

Is anyone else experiencing this issue?

Was it helpful?

Solution

Based on what you've described so far, the only explanation I can come up with is that ELMAH's modules and handler may have been registered under <system.web> only and which is why they are being used by the ASP.NET Development Server (Cassini). IIS Express, on the other hand, expects those modules and handler to be registered under <system.webServer>. Following is an extract from the sample web.config supplied with ELMAH 1.1:

<!-- 
    The <system.webServer> section is required for running ELMAH under Internet
    Information Services 7.0. It is not necessary for previous version of IIS.

    In general, it would be best to include it for all .NET Framework 2.0 and above
    configurations in order to have a more portable solution between various
    versions of IIS.

    IIS 5.x, IIS 6 require the modules and handlers to be declared in <system.web>
    whereas IIS 7 needs them declared here and complains if they are in fact
    declared in <system.web>. Fortunately, the
    <validation validateIntegratedModeConfiguration="false" /> entry tells IIS 7 
    not to worry about the modules and handlers declared in <system.web>.

    If you only ever want to use IIS 7, then do the following:

    1. Remove handlers and modules from <system.web>
    2. Remove the <validation validateIntegratedModeConfiguration="false" /> element
-->

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
        <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
        <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
        <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
        <add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah" preCondition="managedHandler" />
    </modules>
    <handlers>
        <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
    </handlers>
</system.webServer>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top