elmah只发送电子邮件"页面未找到"错误

时间:2014-08-12 12:50:23

标签: asp.net-mvc elmah

我在我的web.config中设置了Elmah,向我发送有关错误的电子邮件。但是,出于某种原因,当我在域名后输入虚假页面时,我只收到电子邮件。任何其他错误,我在网站上看到我的自定义错误页面,所以我收到错误,但没有电子邮件。谁能看到我做错了什么? 这是相关的web.config代码:

    <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>
    <httpModules>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
    </httpModules>
    <system.webServer>
    <httpErrors errorMode="Custom" existingResponse="Replace">
      <remove statusCode="500" subStatusCode="-1" />
      <remove statusCode="404" subStatusCode="-1" />
      <error statusCode="500" path="/Errors/Error" responseMode="ExecuteURL" />
      <error statusCode="404" path="/Errors/Error" responseMode="ExecuteURL" />
    </httpErrors>
    <modules runAllManagedModulesForAllRequests="true">
      <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>
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network host="relay-hosting.secureserver.net" port="25" />
      </smtp>
    </mailSettings>
  </system.net>
      <elmah>
    <errorMail from="from email"
               to="to email"
               subject="Application Error"
               async="true"
               smtpPort="0"
      />
    <security allowRemoteAccess="false" />
    <errorFilter>
      <text>
      </text>
    </errorFilter>
  </elmah>
  <location path="elmah.axd" inheritInChildApplications="false">
    <system.web>
      <httpHandlers>
        <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
      </httpHandlers>
      <authorization>
        <allow roles="admin" />
        <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>
  </location>
</configuration>

1 个答案:

答案 0 :(得分:0)

从web.config elmah部分删除它:

<errorFilter>
    <text>
    </text>
</errorFilter>

我假设空节点由于某种原因默认为过滤404,但我还没有对其进行测试。