Frage

Ich habe versucht, mit meiner asp.net Website zu verwenden Elmah aber wenn ich versuche zu http: // localhost: port / elmah.axd ich Ressource nicht gefunden Ausnahme. Meine web.config ist unten angegeben.

    <?xml version="1.0"?>
    <configuration>
      <configSections>
        <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>
      </configSections>
      <elmah>
        <security allowRemoteAccess="0" />
        <errorLog type="Elmah.SqlErrorLog, Elmah" 
                 connectionStringName="elmah-sql" />
        <errorMail
                from="my@account"
                to="myself"
                subject="ERROR From Elmah:"
                async="true"
                smtpPort="587"
                smtpServer="smtp.gmail.com"
                userName="my@account"
                password="mypassword" />
      </elmah>

      <connectionStrings>
        <add name="elmah-sql" connectionString="data source=(sqlserver); 
               database=elmahdb;
             integrated security=false;User ID=user;Password=password"/>
      </connectionStrings>
      <system.web>
        <compilation debug="true">
          <assemblies>
            <add assembly="Elmah, Version=1.0.10617.0, Culture=neutral, 
               PublicKeyToken=null"/>
          </assemblies>
        </compilation>
        <authentication mode="Windows"/>

        <httpHandlers>
          <remove verb="*" path="*.asmx"/>
          <add verb="*" path="*.asmx" validate="false" 
            type="System.Web.Script.Services.ScriptHandlerFactory, 
               System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
                  PublicKeyToken=31BF3856AD364E35"/>
          <add verb="*" path="*_AppService.axd" validate="false" 
               type="System.Web.Script.Services.ScriptHandlerFactory, 
               System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
                   PublicKeyToken=31BF3856AD364E35"/>
          <add verb="GET,HEAD" path="ScriptResource.axd" 
                 type="System.Web.Handlers.ScriptResourceHandler, 
               System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
                    PublicKeyToken=31BF3856AD364E35" validate="false"/>
        </httpHandlers>
        <httpModules>
          <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, 
                System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
                PublicKeyToken=31BF3856AD364E35"/>
        </httpModules>
      </system.web>

      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules runAllManagedModulesForAllRequests="true">
          <remove name="ScriptModule"/>
          <add name="ScriptModule" preCondition="managedHandler" 
                type="System.Web.Handlers.ScriptModule, 
               System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
                 PublicKeyToken=31BF3856AD364E35"/>
          <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
          <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
          <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
        </modules>

        <handlers>
          <remove name="WebServiceHandlerFactory-Integrated"/>
          <remove name="ScriptHandlerFactory"/>
          <remove name="ScriptHandlerFactoryAppServices"/>
          <remove name="ScriptResource"/>
          <add name="ScriptHandlerFactory" verb="*" path="*.asmx" 
                preCondition="integratedMode" 
               type="System.Web.Script.Services.ScriptHandlerFactory, 
                    System.Web.Extensions, Version=3.5.0.0, 
               Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add name="ScriptHandlerFactoryAppServices" verb="*" 
            path="*_AppService.axd" preCondition="integratedMode" 
               type="System.Web.Script.Services.ScriptHandlerFactory, 
                 System.Web.Extensions, Version=3.5.0.0, 
               Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add name="ScriptResource" preCondition="integratedMode" 
            verb="GET,HEAD" path="ScriptResource.axd" 
               type="System.Web.Handlers.ScriptResourceHandler, 
            System.Web.Extensions, Version=3.5.0.0, 
               Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          <add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" 
                       preCondition="integratedMode" 
               type="Elmah.ErrorLogPageFactory, Elmah"/>
        </handlers>
      </system.webServer>
    </configuration>

EDIT: Elmah = (Error Logging Module und Handlers)
http://code.google.com/p/elmah/

War es hilfreich?

Lösung

Versuchen Sie, die Module und Handlers in den Abschnitten „Httphandlers“ und „Httpmodules“ im <system.web> Abschnitt Registrierung:

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

    </httpHandlers>
    <httpModules>
        .......
        <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
        <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
        <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
       .......
    </httpModules>

Andere Tipps

Ich hatte gerade ein ähnliches Problem mit Elmah nicht in einem IIS7 Einsatz arbeiten. Ich fand, dass ich brauchte, um die Elmah Module und Handlers in system.web UND system.webServer registrieren:

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

Sie sein kann, dieses man braucht auch

<elmah>
    <security allowRemoteAccess="1" />
</elmah> 

, wenn Sie bekommen

  

403 - Verboten: Zugriff verweigert wird.   Sie haben keine Berechtigung dieses Verzeichnis oder die Seite der sehen   Anmeldeinformationen, die Sie geliefert.

Diese Zeile fehlt, als ich mit NuGet installiert (VS 2013, IIS 8.0):

<system.webServer>
  <handlers>
    <add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
 </handlers>
</system.webServer>

Hinzufügen von den 404-Fehler Problem gelöst.

Ein Weg, um es zu bekommen heute ist nuget zu verwenden.

Visual Studio: Menü-> tools-> Bibliothekspaket Manager-> Paket-Manager-Konsole

install-package elmah

HTH

Das nuget Paket nicht fügen Sie die folgenden wichtigen Linien zu web.config in 403 Fehler führt.

<configuration>
  <elmah>  
    <security allowRemoteAccess="1" />
    <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/app_data/elmah" />
  </elmah>
</configuration>

Auch Sie können den Zugriff auf Fehlerprotokolle von

beschränken
<add name="Elmah" verb="POST,GET,HEAD" path="/admin/elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />

Wenn Sie Bereiche verwenden, stellen Sie sicher, dass Sie eine der Appsetting Schlüssel aktualisiert

Standard

<add key="elmah.mvc.route" value="elmah" />

Wenn Sie einen Bereich als Admin sind

<add key="elmah.mvc.route" value="admin/elmah" />
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top