habcerga1
@habcerga1

Причина ошибки при подключении к Mysql C#?

Добрый день господа решил изучать связку mysql + asp.mvc но начались проблемы с Connection to DB и решил проверить через консольное приложение на c# как происходит соединение с Mysql на localhost, но когда начал запускать то выдало
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 стоит на MacOs и Visual Studio тоже на MacOs. Своими силами я понять не смог, возможно кто-нибудь знает заранее спасибо.
  • Вопрос задан
  • 1439 просмотров
Пригласить эксперта
Ответы на вопрос 1
Добрый день.
Вам ошибка вполне по англиски написала:
Unrecognized configuration section (/Users/habcerga1/Desktop/Projects/Demo6/Demo6/bin/Debug/Demo6.exe.config line 11)
Так что проверяйте 11 строку в /Users/habcerga1/Desktop/Projects/Demo6/Demo6/bin/Debug/Demo6.exe.config
файле
Инициализатор клиента MySql когда парсит Ваш конфиг файл непонимает что там написано
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы