sean
sean

Reputation: 9268

Configuration System Failed to Initialize

I'm new to Visual Studio and MySQL. I'm thinking if somebody can tell me what's wrong with this code.

app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<add key="ODBCDriver" value="Driver={MySQL ODBC 5.1 Driver};Server=localhost;"/>
<add key="DataBaseDetails" value="Database=timekeeping;uid=root;pwd=admin;Option=3;"/>
<configSections>
<sectionGroup name="userSettings"
    type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0,    Culture=neutral, PublicKeyToken=b77a5c561934e089" >
 </sectionGroup>
 </configSections>
 </configuration>

There is an error stating Configuration system failed to initialize.

Please help.

Upvotes: 0

Views: 1154

Answers (3)

liferunner
liferunner

Reputation: 96

My reason for this issue was incompatibility between MySql.Data.dll and .Net framework version. Once I found lates version of MySql.Data.dll for .NET 5, this issue gone. Prior to change dll I gave a try to various suggestions within and without config file, with no luck.

Upvotes: 0

ravirajlad
ravirajlad

Reputation: 1

This work for me. Make sure that your app.config or web.config start with the tag inside the tab e.g

and in your case you have not end the tag

after that make sure taht targate Framework property of your project must not be client profile

Upvotes: 0

Jen
Jen

Reputation: 2004

Firstly is there a reason you're not using a ConnectionString instead of custom keys?

Secondly can't you just use an Appsettings section to define your keys? Assuming you are looking them up in your code:

eg. like:

<configuration>
      <appSettings>
        <add key="MappingLibrary" value="Model.dll" />
        <add key="ServicesLibrary" value="Services.dll" />
    </appSettings>

or you might just be able to replace the appsettings with your userSettings element?

Upvotes: 3

Related Questions