无法通过URL访问Elmah

时间:2019-02-18 12:40:23

标签: c# elmah

我在应用程序中安装了elmah。我的应用程序URL是localhost:53245 / Default.aspx,添加elmah后,它将类似于此localhost:53245 / Default.aspx / elmah.axd。它不起作用。它停留在相同的默认页面。我的项目是MVP结构。请帮助。

web.config

      <?xml version="1.0" encoding="utf-8"?>
      <configuration>
      <configSections>
      <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
      <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>
      <enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
      <sources>
      <add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" filePath="Entlib.config" />
      </sources>
      </enterpriseLibrary.ConfigurationSource>

      <appSettings>

      </appSettings>
      <system.net>

      </system.net>
      <system.web>
      <authentication mode="Windows" />
      <customErrors mode="Off" defaultRedirect="~/ErrorsView.aspx" redirectMode="ResponseRewrite" />
      </controls>
      </pages>
      <httpHandlers>

      </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.codedom>
      <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <providerOption name="CompilerVersion" value="v4.0" />
      <providerOption name="WarnAsError" value="false" />
      </compiler>
      </compilers>
      </system.codedom>
      <system.serviceModel>
      <bindings>
      <basicHttpBinding>
      <binding name="BasicHttpBinding_IWsdsService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" useDefaultWebProxy="true" />
      </basicHttpBinding>
      </bindings>
      <client>
      <endpoint address="http://localhost:6949/hfjfjfjf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWsdsService" contract="WsdsService.IWsdsService" name="BasicHttpBinding_IWsdsService" />
      </client>

      </system.serviceModel>
      <system.webServer>

      <modules>
      <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="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>
     <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" />
     </handlers>
     <httpErrors errorMode="Detailed" />
     <asp appAllowClientDebug="false" appAllowDebugging="false" enableParentPaths="true" scriptErrorSentToBrowser="false" bufferingOn="true" />
     <validation validateIntegratedModeConfiguration="false" />
 </system.webServer>
     <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <dependentAssembly>
     <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
     <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
     </dependentAssembly>
     <dependentAssembly>
     <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
     <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
     </dependentAssembly>
     <dependentAssembly>
     <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="3a9cab8f8d22bfb7" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-3.1.3.42154" newVersion="3.1.3.42154" />
     </dependentAssembly>
     <dependentAssembly>
     <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-3.3.1.4000" newVersion="3.3.1.4000" />
     </dependentAssembly>
     <dependentAssembly>
     <assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31BF3856AD364E35" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-2.0.414.0" newVersion="2.1.505.0" />
     </dependentAssembly>
     <dependentAssembly>
     <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" culture="neutral" />
     <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
     </dependentAssembly>
     </assemblyBinding>
     </runtime>


 <location path="elmah.axd" inheritInChildApplications="false">
     <system.web>
     <httpHandlers>
     <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
     </httpHandlers>
     <!-- 
     See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for 
     more information on using ASP.NET authorization securing ELMAH.
     -->
     <authorization>
     <allow roles="Administration" />
     <deny users="*" />  
     </authorization>

     </system.web>
     <system.webServer>
     <handlers>
     <add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
     </handlers>
     </system.webServer>
 <elmah>
      <!--
        See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for 
        more information on remote access and securing ELMAH.
      -->
      <security allowRemoteAccess="1" />
      <errorLog type="Elmah.XmlFilerErrorLog, Elmah"     logPath="~/App_Data/elmahlogs" />
      </elmah>
     </location>
    </configuration>

如何解决此问题。我将default.aspx页面设置为默认页面。

1 个答案:

答案 0 :(得分:0)

应该从网站的根目录而不是通过默认页面访问Elamah。

localhost:53245/elmah.axd