C# Exception: Solution Configuration System Failed to Initialize

Today I encountered an exception while working on an application. The exception was “configuration system failed to initialize”. The problem I was having in my application configuration file was that I declared the <appSettings> tag immediately after the root tag <configuration>.

The schema of a configuration file requires that the <configSections> tag is the first child of the root tag. Thus, if you use any other tag as the first child of the root <configuration> tag, the application would throw an exception. So the <configSections> tag should always immediately follow the root <configuration> tag.

Correct Format

<?xml version="1.0"?>
<configuration>
   <configSections>
      <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, 
      System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
          <section name="your_project_name.Properties.Settings" type="System.Configuration.ClientSettingsSection,      System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </sectionGroup>

Wrong Format

<?xml version="1.0"?>
<configuration>
   <appSettings>
       ...
       ...
       ...
   </appSettings>
   <configSections>
      .....
    </configSections>

This is just one of the reasons for which the exception is thrown. There is more than one reason for it. For me, this solution worked. I hope it works for you as well!

I hope this helps!

 


Similar Articles