简体   繁体   中英

Elmah doesn't work on the server

Elmah appears to work on my dev machine but on the server I can request elmah.axd fine but it doesn't log any exceptions. There are no error messages and there is no feed back it just doesn't work (which ought to be the slogan for a rubbish software company)

Here are selected highlights from my web.config file:

    <elmah>
 <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data/errors" />

    <security allowRemoteAccess="false" />
  </elmah>
<location path="elmah.axd" inheritInChildApplications="false">
    <system.web>
      <httpHandlers>


        <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
      </httpHandlers>

     <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>
      <handlers>
        <add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
      </handlers>
<modules>
             <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</modules>
    </system.webServer>
  </location>

Any ideas?

The offending bit of config is I think...

<location path="elmah.axd" inheritInChildApplications="false">

When I installed Elmah Nuget made a bit of a mess of web.config. It added unnecessary and corrupting xmlns="" s and added additional system.webserver and system.web sections which aren't allowed.

Something must have confused it which resulted in this location tag being added that I'm guessing resulted in the modules/handlers being given too narrow a scope to catch all errors.

I don't have any idea why this worked locally but not remotely. Maybe because my remote deploy is in a virtual directory?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM