Error starting Update-Database in MVC5

I have an MVC 5 application that has a MySQL database hosted in Azure. It worked fine, but today, when I tried to enter Update-Database and run it, I got the following error message:

System.Runtime.Serialization.SerializationException: Type is not resolved for member 'MySql.Data.MySqlClient.MySqlException,MySql.Data, Version=6.9.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'. at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate) at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner) at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force) at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) Type is not resolved for member 'MySql.Data.MySqlClient.MySqlException,MySql.Data, Version=6.9.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'. 

What could be the problem, and how can I solve it?

+5
source share
2 answers

I had this problem before:

1.- Install the mysql connector update in the new version: http://dev.mysql.com/downloads/connector/net/

2.- Since you are trying to connect to a remote MySQL installation, you need to make sure that the port is open. You can try connecting to your local MySQL database to verify this.

I hope this work is for you too.

+9
source

Just in case, someone came across this error "Type is not allowed for a member":

This post is very misleading because it is shown on many issues that have nothing to do with what you can assume from this post.

In most cases, when I came across this message, it was some code inside the mapped class throwing an exception when the Seed method was executed. Watch out for custom implementations of ToString () and GetHashCode ().

The VS debugger is your best friend in this case. Just add the following code to the Seed () method:

  if (System.Diagnostics.Debugger.IsAttached == false) System.Diagnostics.Debugger.Launch(); 

Run the second instance of VS with your project before running the Update-Database command, and you will see what is wrong.

+3
source

Source: https://habr.com/ru/post/1206443/


All Articles