【问题标题】:Elmah and Sitecore and 404 error processingElmah 和 Sitecore 以及 404 错误处理
【发布时间】:2012-11-04 00:43:52
【问题描述】:

您好,我正在尝试使用 Sitecore 设置 ELMAH,我已阅读此 http://newguid.net/sitecore/2011/using-elmah-for-error-logging-within-sitecore/#t-recent,从我的角度来看,它的解决方案运行良好,但存在一些错误。 1. ELMAH 跳过存储 404 以在所有情况下存储在日志中 + 2. 如果 URL 包含“.”,Sitecore 不处理 404 错误字符。例如 http://mysite/wrongurl 将我重定向到 404.html 但 http://mysite/wrongurl.dfgd 向我显示应用程序中的服务器错误 (IIS 7.5) (不是我的 404.html) 这是我刚刚与 ELMAH 相关的设置和处理错误

    <configSections>
    <sectionGroup name="elmah">
        <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah"/>
    </sectionGroup>  
  </configSections>
  <elmah>
     <!-- NetKeyElmah inside of App_Config\ConnectionStrings.config  -->
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ElmahData" />
  </elmah>
  <sitecore>
   <settings> 
      <setting name="ItemNotFoundUrl" value="/404.html" />      
      <setting name="LayoutNotFoundUrl" value="/404.html" />        
      <setting name="LinkItemNotFoundUrl" value="/sitecore/service/notfound.aspx" />
      <setting name="IgnoreUrlPrefixes" value="/sitecore/admin/elmah.axd|/sitecore/default.aspx" />
    </settings>
  </sitecore>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">      
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
    </modules>
    <handlers>      
      <add name="Elmah" path="/sitecore/admin/elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
    </handlers>        
  </system.webServer>
 <system.web> 
    <customErrors mode="On" defaultRedirect="/errorpage.html" >
      <error statusCode="404" redirect="/404.html" />
      <error statusCode="500" redirect="/500.html" />
    </customErrors>   
 </system.web>  

如何设置以正确的方式完成我的设置。

【问题讨论】:

    标签: asp.net error-handling sitecore elmah


    【解决方案1】:

    响应 2.

    默认情况下,IIS 不会处理所有类型的文件。如果您希望 IIS 或 Sitecore 处理它无法识别的给定文件类型,您需要在 web.config 中指定它。更新 web.config 中的以下两个部分,以包含您希望 Sitecore 处理的文件类型:

    &lt;param desc="Allowed extensions (comma separated)"&gt;aspx, ashx, asmx, asp&lt;/param&gt;

    &lt;param desc="Allowed extensions (comma separated)"&gt;aspx,asp&lt;/param&gt;

    在这些部分中,您将添加当前引发错误的文件扩展名,这将使 Sitecore 处理您的文件类型。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-20
      • 2013-07-05
      • 1970-01-01
      • 1970-01-01
      • 2010-10-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多