2

I am getting this exception "Configuration system failed to initialize" while reading connection string from app_config in window application

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

on this line after entering following lines

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

in AssemblyInfo.cs. if i remove this line from Assemblyinfo.cs then there is no exception i am adding this assembly for logging purpose

Ross Patterson
  • 9,527
  • 33
  • 48
user557168
  • 161
  • 1
  • 2
  • 4

2 Answers2

9

I am not sure but if you are using VSTO for MS Office Add-In Development than below post might help you.

Why is log4net not recognized in configuration file?

You need to add log4net also in the section block

<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/> 
</configSections>
Community
  • 1
  • 1
0

This is a .NET problem, not a log4net problem. Your app.config file isn't being loaded. See Configuration System Failed to Initialize for a good answer to the real problem.

Community
  • 1
  • 1
Ross Patterson
  • 9,527
  • 33
  • 48