问题
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