log4net configuration - failed to find section

后端 未结 2 1830
生来不讨喜
生来不讨喜 2020-12-10 11:36

This is my error message:

log4net:ERROR XmlConfigurator: Failed to find configuration section \'log4net\' in the application\'s .config file. Check your .con         


        
2条回答
  •  南方客
    南方客 (楼主)
    2020-12-10 12:10

    Are you calling XmlConfigurator.Configure() somewhere?

    Remove those calls and only add the [assembly: log4net.Config.XmlConfigurator(Watch = true)] attribute.

    Normally it is easier to configure log4net in a separate file. Create a file log4net.config and change your attribute to:

    [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)]
    

    Remove the section in your web.config.

提交回复
热议问题