Configuration System Failed to Initialize
app-config, c#
Solution
Put `<configSections>` before `<appSettings>` and it should work
<configuration>
<configSections>
...
</configSections>
<appSettings>
...
</appSettings>
</configurations>
Problem
I'm writing a small program in C# visual Studio 2010, using 2.0 .Net framework. I'm trying to read values from an App.config file. My config file looks like this... ``` <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="MyApp.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <applicationSettings> <add key="Path" value ="C:\Program Files\MyApp\bin\" /> <add key="UserName" value="UserName" /> <add key="Pword" value="Password" /> </applicationSettings> </configuration> ``` Then in my code at: ``` path = ConfigurationManager.AppSettings["Path"]; ``` I get a runtime error "Configuration System Failed to Initialize". From what I've read the configSection has to be first in the file, but I've done this and still get the error.