I
I
Igor Tkhorik2018-02-12 01:14:54
MySQL
Igor Tkhorik, 2018-02-12 01:14:54

Cause of error when connecting to Mysql C#?

Good afternoon, gentlemen, I decided to study the mysql + asp.mvc bundle, but problems began with Connection to DB and decided to check through the console application in c # how the connection to Mysql on localhost is going on, but when I started running it, it gave out

Connecting to MySQL...
System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.MySqlConfiguration' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section <entityFramework> (/Users/habcerga1/Desktop/Projects/Demo6/Demo6/bin/Debug/Demo6.exe.config line 11)
  at System.Configuration.ConfigInfo.ThrowException (System.String text, System.Xml.XmlReader reader) [0x00000] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/ConfigInfo.cs:77 
  at System.Configuration.SectionGroupInfo.ReadContent (System.Xml.XmlReader reader, System.Configuration.Configuration config, System.Boolean overrideAllowed, System.Boolean root) [0x00127] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:330 
  at System.Configuration.SectionGroupInfo.ReadRootData (System.Xml.XmlReader reader, System.Configuration.Configuration config, System.Boolean overrideAllowed) [0x00007] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:273 
  at System.Configuration.Configuration.ReadConfigFile (System.Xml.XmlReader reader, System.String fileName) [0x000ce] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/Configuration.cs:572 
  at System.Configuration.Configuration.Load () [0x00043] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/Configuration.cs:532 
  at System.Configuration.Configuration.Init (System.Configuration.Internal.IConfigSystem system, System.String configPath, System.Configuration.Configuration parent) [0x0005d] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/Configuration.cs:138 
  at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00056] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/Configuration.cs:96 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x0000d] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/InternalConfigurationFactory.cs:41 
  at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (System.Configuration.ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x000ea] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:119 
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x0000e] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:49 
   --- End of inner exception stack trace ---
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x0001f] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:52 
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:61 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in /Users/builder/data/lanes/5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:159 
  at MySql.Data.MySqlClient.MySqlConfiguration..cctor () [0x00000] in <74be5e8f18954f50971400e8a215dc5d>:0 
   --- End of inner exception stack trace ---
  at MySql.Data.MySqlClient.Replication.ReplicationManager..cctor () [0x0001e] in <74be5e8f18954f50971400e8a215dc5d>:0 
   --- End of inner exception stack trace ---
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x0016d] in <74be5e8f18954f50971400e8a215dc5d>:0 
  at Tutorial1.Main () [0x0001a] in /Users/habcerga1/Desktop/Projects/Demo6/Demo6/Program.cs:15 
Done.

Mysql is on MacOs and Visual Studio is also on MacOs. On my own, I could not understand, maybe someone knows, thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Panov, 2018-05-24
@PanovAndrey

Good afternoon.
You wrote an error quite in English:
Unrecognized configuration section (/Users/habcerga1/Desktop/Projects/Demo6/Demo6/bin/Debug/Demo6.exe.config line 11)
So check line 11 in /Users/habcerga1/Desktop/Projects /Demo6/Demo6/bin/Debug/Demo6.exe.config
file
MySql client initializer when parsing your config file does not understand what is written there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question