2011-12-12 76 views
2

我得到这个例外初始化“配置系统初始化失败”,而进入下面的行配置系统未能在log4net的

[assembly: log4net.Config.XmlConfigurator(Watch = true)] 
后,这条线从APP_CONFIG读取连接字符串窗口申请

string con = ConfigurationSettings.AppSettings["ConnectionString"].ToString(); 

在AssemblyInfo.cs中。如果我从Assemblyinfo.cs中删除此行,那么我没有任何异常,我将此程序集添加到日志记录中

回答

6

我不确定,但是如果您使用VSTO进行MS Office插件开发,则可能会对您有所帮助。

Why is log4net not recognized in configuration file?

您还需要添加log4net的一节块

<configSections> 
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> 
</configSections>