0
我已配置ELMAH来捕获错误。Elmah错误日志记录 - 用户 - 访问电子邮件警报
当我浏览到localhost:portno/elmah.axd时,我可以看到所有的错误。
1)我可以看到错误。但是我只想向少数角色或用户展示这一点。 2)如何在一定时间内显示错误? 3)我如何设置警报,当错误发生时
我在哪里做这个配置怎么样?
谢谢 哈日
我已配置ELMAH来捕获错误。Elmah错误日志记录 - 用户 - 访问电子邮件警报
当我浏览到localhost:portno/elmah.axd时,我可以看到所有的错误。
1)我可以看到错误。但是我只想向少数角色或用户展示这一点。 2)如何在一定时间内显示错误? 3)我如何设置警报,当错误发生时
我在哪里做这个配置怎么样?
谢谢 哈日
你可以在你的web.config与ASP.net授权安全elmah.axd,就像这样:
<location path="elmah.axd">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
错误的持续时间取决于其持续性的方法,你已配置。我建议使用某种类型的数据库来存储错误:SQL Server,SQLite或SQLCE,这样您可以按计划清理错误或者直接将它们永久保留。
要配置电子邮件警报,您将需要添加几件事情在你的web.config。首先,找到你的ELMAH sectionGroup并添加errorMail部分,像这样:
<configSections>
<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" />
</sectionGroup>
</configSections>
然后添加一个errorMail设置将ELMAH组:
<elmah>
<security allowRemoteAccess="0" />
<errorLog type="Elmah.SqlErrorLog, Elmah" />
<errorMail from="[email protected]" to="[email protected]" subject="ELMAH error" smtpPort="25" smtpServer="localhost" />
</elmah>
您还可以检查出更多的选择维基或更多信息: http://code.google.com/p/elmah/w/list
感谢克,感谢您的耐心和答案 –