【问题标题】:How to exclude 404 from ELMAH如何从 ELMAH 中排除 404
【发布时间】:2016-07-13 08:40:50
【问题描述】:

目前在 ELMAH 错误日志中,我们希望消除/移除 404 错误,因为这是无用的并且会消耗我们的数据库存储空间。

知道如何排除 404,尤其是通过 web.config 吗?

【问题讨论】:

标签: c# .net elmah error-logging


【解决方案1】:

您可以通过在您网站的网络配置文件中设置以下内容轻松跳过 404 错误:

    <elmah>
    <security allowRemoteAccess="yes" />
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah-ErrorLog" applicationName="YourAPPName" />
    <errorFilter>
        <test>
            <or>
                <regex binding="Exception.Message" pattern="Server cannot modify cookies after HTTP headers have been sent\." />
                <equal binding="HttpStatusCode" value="404" type="Int32" />
            </or>
        </test>
    </errorFilter>
</elmah>

【讨论】:

    猜你喜欢
    • 2016-01-27
    • 2019-12-18
    • 2010-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-20
    • 2010-10-20
    • 2022-10-05
    相关资源
    最近更新 更多