what part of web.config do i insert the elmah tag?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 19:18:34

问题


I want to write this

<elmah>
    <errorlog type="Elmah.XmlFilerErrorLog, Elmah" logPath="~/App_Data" />
</elmah>

or

<elmah>
  <errorLog type="Elmah.SQLiteErrorLog, Elmah" logPath="~/App_Data" />
</elmah>

however every place i tried putting this tag in i get an Unrecognized configuration section elmah. error. I found this question Configuring ELMAH: Unrecognized config section error however i tried that (solution at the bottom of the question) and still get the error. Where do i put this?

-edit- i found the issue. I didnt set <sectionGroup name="elmah"> properly. I couldnt find it online then remembered the demo had sqlite logging and i checked the demo config for clues.


回答1:


You need to add the section group. Something like this:

<sectionGroup name="elmah">
  <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
</sectionGroup>

Then you can add the elmah section anywhere inside the "configuration" tag (not inside any other tag).



来源:https://stackoverflow.com/questions/2108211/what-part-of-web-config-do-i-insert-the-elmah-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!