【发布时间】:2017-02-19 05:08:55
【问题描述】:
当已知进程访问我们网站上不存在的 URL 时,ELMAH 会生成如下异常:
System.Web.HttpException:路径“/manager/”的控制器不是 找到或没有实现 IController。
而从浏览器访问该不存在的 URL 会生成典型的 IIS 404。
找不到资源。说明:HTTP 404。你的资源 正在寻找(或其依赖项之一)可能已被删除, 名称已更改,或暂时不可用。请查阅 以下 URL 并确保其拼写正确。
请求的网址:/manager
我知道访问这些地址的过程是无害的,并且希望停止接收这些特定的电子邮件,这些电子邮件是从一系列 IP 地址生成的。这就是我在 web.config 中的内容,但 ELMAH 电子邮件仍然可以通过。
URL 过滤器似乎工作正常。
<elmah>
<security allowRemoteAccess="false" />
<errorMail from="elmah@mydomain.com" to="elmahlog@mydomain.com" async="true" smtpServer="mail.mydomain.com" smtpPort="25" useSsl="false" />
<errorFilter>
<test>
<and>
<equal binding="HttpStatusCode" value="500" type="Int32" />
<or>
<!--TrustWave scans our website with intentional bad addresses-->
<regex binding="Context.Request.ServerVariables['REMOTE_ADDR']" pattern="64.37.231.\d{1,3}" type="String" />
<!--Google looking for Digital Asset Links - well known statements the website wants to make-->
<regex binding="Context.Request.ServerVariables['URL']" pattern="/.well-known/assetlinks.json" type="String" />
<!--Apple devices searching for universal links - app-site association. we dont have an app.-->
<regex binding="Context.Request.ServerVariables['URL']" pattern="/.well-known/apple-app-site-association" type="String" />
</or>
</and>
</test>
</errorFilter>
</elmah>
【问题讨论】:
标签: asp.net-mvc elmah elmah.mvc