功能:给网站记录错误日志
添加:在NuGet中搜索ELMAH并添加Elmah.MVC
使用:
<elmah>
<security allowRemoteAccess="0" />
<errorMail from="发件箱地址"
to="收件箱地址"
subject="网站错误日志"
priority="High"
async="false"
smtpPort="25"
smtpServer="smtp.163.com"
useSsl="true"
noYsod="false"
userName="邮箱账号"
password="邮箱密码" />
<errorFilter>
<test>
<and>
<!--过滤400到499的错误 部分url转发可能会引发404错误 -->
<greater binding="HttpStatusCode" value="399" type="Int32" />
<lesser binding="HttpStatusCode" value="500" type="Int32" />
<!--<equal binding="HttpStatusCode" value="404" type="Int32" />-->
<!--过滤404错误-->
</and>
</test>
</errorFilter>
</elmah>
效果: