0

I created an ASP.NET Web Application (.NET Framework) with .NET Framework 4.7 and with ASP.NET Web Forms template and authentication mode Individual User Accounts.


My connection string

<add name="DefaultConnection" connectionString="server=mysql server;password=password;port=3306;uid=username;database=schemaname" providerName="MySql.Data.MySqlClient"/>

(It's filled with CORRECT values, but I don't want to publish them...)
Entity Framework

  <entityFramework>
    <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
    <providers>
        <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
    </providers>
</entityFramework>

Error

System.InvalidOperationException: 'The Entity Framework provider type 'MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6' registered in the application config file for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.'

at

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
     public ApplicationDbContext()
        : base("DefaultConnection", throwIfV1Schema: false)//<-- this line
     {
     }

     public static ApplicationDbContext Create()
     {
         return new ApplicationDbContext();
     }
}

I already read those:

When I fixed an error another appeared after fixing than appeared another and so on, so I created a new project with settings above and I hope someone can help me to solve this issue. (This is my first time using ASP.NET Web Forms)

Noel Nemeth
  • 646
  • 11
  • 21

1 Answers1

8

You appear to be using MySql.Data.Entity 6.10.7. I'm going to guess you're also using MySql.Data 8.0.11.

These two libraries are not compatible. Oracle renamed the package to MySql.Data.EntityFramework for v8.x. You need to uninstall MySql.Data.Entity and install MySql.Data.EntityFramework.

Bradley Grainger
  • 27,458
  • 4
  • 91
  • 108