每个配置文件中只允许存在一个 <configSections> 元素,并且,如果存在该元素,它还必须是根 <configuration> 元素的第一个子元素。
问题:
I have this code in web.config:
And I have downloaded log4net.dll and placed it in Bin Folder.
In one of My aspx.cs pages I have added this code:
using log4net;[assembly: log4net.Config.XmlConfigurator(Watch = true)]private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
But it's giving error as Unrecognized configuration section log4net.
解决方案:
You need to declare the log4net section:
Take a closer look at the documentation which explains the necessary things to do.