2011-12-12 29 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>