MySql connection with Entity Framework - mysql

I have the following code in Web.config:
<entityFramework>
<!--<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />-->
<defaultConnectionFactory type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
<providers>
<!--<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />-->
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<connectionStrings>
<!--<add name="EFDbContext" connectionString="Data Source=LocalPC\SQLEXPRESS; Initial Catalog=testDB; Integrated Security=true" providerName="System.Data.SqlClient" />-->
<add name="EFDbContext" connectionString="server=localhost; database=testDB; user id=root; password=test" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
However, on this line in code:
readonly EFDbContext context = new EFDbContext();
I get the following 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.'
I have installed MySql.Data and MySql.Data.Entity
Can somebody please help me fix this issue?

Related

RoleProvider .NET 2 - converted from MS Access to MySQL

I have an old site running on .NET 2 using an AccessMembershipProvide and I'm changing it to MySqlMemebrshipProvider - The membership side works fine, but the roles part seems to not provide the roles methods?
If I switch back to the OdbcRoleProvide in the Web.Config it works while still using the MySqlMembershipProvider.
I'm calling the roles with: Response.Write(Roles.IsUserInRole(User.Identity.Name, "Admin") & " -role exist- " & Roles.RoleExists("Admin"))
this returns false even with logged in user.?
NOTE: I'm running it on a hosted site and don't have access to Visual Studio (I know this makes debugging incredibly difficult)!!!
Web.Config:
<connectionStrings>
<clear />
<add name="OdbcServices" connectionString="Driver={Microsoft Access Driver (*.mdb)};Dbq=e:\App_Data\subsite.mdb;" />
<add name="ConnString" connectionString="Database=Training;Data Source=localhost;User Id=myuser;Password=mypassword" />
</connectionStrings>
<system.web>
<compilation debug="true" strict="false" explicit="true">
<codeSubDirectories>
<add directoryName="VBCode" />
<add directoryName="CSCode" />
</codeSubDirectories>
</compilation>
<!--
<membership defaultProvider="AccessMembershipProvider"
userIsOnlineTimeWindow="20">
<providers>
<clear />
<add name="AccessMembershipProvider"
type="AccessMembershipProvider"
enablePasswordReset="true"
enablePasswordRetrieval="true"
requiresQuestionAndAnswer="true"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\App_Data\subsite.mdb;Persist Security Info=False"
/>
</providers>
</membership>
<roleManager defaultProvider="OdbcRoleProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<clear />
<add name="OdbcRoleProvider"
type="Samples.AspNet.Roles.OdbcRoleProvider"
connectionStringName="OdbcServices"
applicationName="SampleApplication"
writeExceptionsToEventLog="false" />
</providers>
</roleManager>
-->
<!-- http://www.codeproject.com/Articles/12301/Membership-and-Role-providers-for-MySQL -->
<roleManager defaultProvider="MySqlRoleProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<clear />
<add
name="MySqlRoleProvider"
type="Andri.Web.MySqlRoleProvider"
connectionStringName="ConnString"
applicationName="SampleApplication"
writeExceptionsToEventLog="false"
/>
</providers>
</roleManager>
<membership defaultProvider="MySqlMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="MySqlMembershipProvider"
type="Andri.Web.MySqlMembershipProvider"
connectionStringName="ConnString"
applicationName="ApplicationName"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="false"
passwordFormat="Clear"
writeExceptionsToEventLog="false"
/>
</providers>
</membership>
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" />
</authentication>
...
Not sure why reverting back to RolesProvider.vb did not cause the same response, however there was an erroneous SQL statement in the MembershipProvider.cs. This resolved the problem and the RolesProvider is responding as desired.

To call this method, the “Membership.Provider” property must be an instance of “ExtendedMembershipProvider”

I am working on Asp.Net WebAPI Project. I am using MySQL Membership provider. While creating account I get the following Exception:
To call this method, the “Membership.Provider” property must be an instance of “ExtendedMembershipProvider”
Web.Config
<membership defaultProvider="MySQLMembershipProvider">
<providers>
<clear/>
<add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="DefaultConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
</providers>
</membership>
<profile defaultProvider="MySQLProfileProvider" enabled="true">
<providers>
<clear />
<add type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.8.3, Culture=neutral" name="MySqlProfileProvider" applicationName="/" connectionStringName="DefaultConnectionString" autogenerateschema="true" />
<remove name="MySQLProfileProvider" />
<add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="DefaultConnectionString" applicationName="/" /></providers>
</profile>
<roleManager enabled="true" defaultProvider="MySQLRoleProvider">
<providers>
<clear />
<add connectionStringName="DefaultConnectionString" applicationName="/" name="MySqlRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web" autogenerateschema="true" />
<remove name="MySQLRoleProvider" /><add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="DefaultConnectionString" applicationName="/" /></providers>
</roleManager>
To use membership provider, first you need to initialize(InitializeDatabaseConnection) membership provider in AppStart
Using MySQL 5 , Simple Membership Provider, ASP.NET MVC4 with Entity Framework 5
Using Simple Membership Provider with mysql

Can't connect to MySql database with Entity Framework 6

Installed via NuGet: MySql.Data, MySql.Data.Entities, MySql.Data.Entity.
Web.config:
<connectionStrings>
<add name="WhateverEntities" providerName="MySql.Data.MySqlClient" connectionString="server=127.0.0.1;port=3306;database=dbname;uid=root;password=pass" />
<connectionStrings>
...
<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, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
<entityFramework>
ApplicationDbContext.cs:
public ApplicationDbContext() : base(nameOrConnectionString: "WhateverEntities") {}
tried to add:
[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
and:
[DbConfigurationType(typeof(MySqlEFConfiguration))]
got this error:
An exception of type
'System.Data.Entity.Core.ProviderIncompatibleException' occurred in
EntityFramework.dll but was not handled in user code
Additional information: The provider did not return a
ProviderManifestToken string.
What's wrong?
It was a matter of password as vdwijngaert suggested. Changed it in PhpMyAdmin.

InnerException : Table 'xxx.aspnetusers' doesn't exist

I have an ASP.NET MVC 4 Web API project which uses Entity Framework 6.1.1 and MySQL 6.9.5.0. When I call /api/Account/Register using DHC, the code breaks at
IdentityResult result = await UserManager.CreateAsync(user, model.Password);
in the AccountController and I get an InnerException which says
Table 'xxx.aspnetusers' doesn't exist
Here are pieces of my web.config
<connectionStrings>
<add name="ClockitDb" connectionString="Data Source=ClockitDb;port=3306;Initial Catalog=ClockitDb;Server=localhost;user id=root;password=m916600026;"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<!-- Some code-->
<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<!-- Some code-->
<system.web>
<authentication mode="Forms" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<membership defaultProvider="MySQLMembershipProvider">
<providers>
<remove name="MySQLMembershipProvider" />
<add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
</providers>
</membership>
<profile defaultProvider="MySQLProfileProvider">
<providers>
<remove name="MySQLProfileProvider" />
<add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</profile>
<roleManager defaultProvider="MySQLRoleProvider">
<providers>
<remove name="MySQLRoleProvider" />
<add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</roleManager>
<siteMap defaultProvider="MySqlSiteMapProvider">
<providers>
<remove name="MySqlSiteMapProvider" />
<add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</siteMap>
<webParts>
<personalization defaultProvider="MySQLPersonalizationProvider">
<providers>
<remove name="MySQLPersonalizationProvider" />
<add name="MySQLPersonalizationProvider" type="MySql.Web.Personalization.MySqlPersonalizationProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</personalization>
</webParts>
<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
I had exactly the same problem .
I followed the following tutorial and it worked
How to set up application using ASP.NET Identity with MySQL Provider
It is important that you follow all the steps of the tutorial,even the migration setup, otherwise it gives the same error.
The exception clearly states that aspnetusers is missing from your database. However, on more findings, I think you would like to go through this answer from asp.net forum.
http://forums.asp.net/t/1977214.aspx?Mvc+5+Identity+Error+Invalid+object+name+dbo+AspNetUsers
For Role,Membership Provider, asp.net [entire asp.net stack/webapi included] with mysql, you need to have that providers specific to mysql in place. For this, you can refer to
http://www.codeproject.com/Articles/117157/Setting-up-MySql-Membership-with-Visual-Studio
Let me know, if this solves your problem.
I tried following the instructions on
http://www.codeproject.com/Articles/117157/Setting-up-MySql-Membership-with-Visual-Studio.
When I launch the security tab in ASP Website administration tool, I get an error saying
The pre-application start initialization method Start on type WebMatrix.WebData.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (C:\Users\Jaseem Abbas\Documents\Visual Studio 2013\Projects\MySQLSample1\MySQLSample1\web.config line 33).
My line 33 in web config starts as
<membership defaultProvider="MySQLMembershipProvider">
<providers>
<add name="MySQLMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider,
MySql.Web, Version=6.9.5.0,
Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
connectionStringName="LocalMySqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
applicationName="/"
autogenerateschema="true" />
</providers>
</membership>
<profile>ASP
<providers>
<clear />
<add type="MySql.Web.Security.MySQLProfileProvider,
MySql.Web, Version=6.9.5.0,
Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
name="MySqlProfileProvider"
applicationName="/"
connectionStringName="LocalMySqlServer"
autogenerateschema="true" />
</providers>
</profile>
<roleManager enabled="true" defaultProvider="MySqlRoleProvider">
<providers>
<clear />
<add connectionStringName="LocalMySqlServer"
applicationName="/"
name="MySqlRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider,
MySql.Web, Version=6.9.5.0,
Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
autogenerateschema="true" />
</providers>

Deploying - MySQL with Entity Frame Work

I have an MVC4 app which is ready to be deployed. The app is database first entity framework with MySQL not MSSQL. As far as dubugging goes, I have no errors with the connection string below but when I go to deploy the app to Amazon Elastic Beanstalk it brings me to the login screen but when i go to login, it throws an error:
Failed to find or load the registered .Net Framework Data Provider.
I'm not sure what the correct way to have a web.config configured for MySQL Deployments assuming that the web config is the problem to begin with. Any ideas on what I'm missing?
Web.Config:
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="MyFinDevEntities" connectionString="metadata=res://*/MyFinAdminModel.csdl|res://*/MyFinAdminModel.ssdl|res://*/MyFinAdminModel.msl;provider=MySql.Data.MySqlClient;provider connection string="user id=xxxxx;password=xxxxx;server=xxxxx.us-west-2.rds.amazonaws.com;database=xxxxDev"" providerName="System.Data.EntityClient" /> <!-- providerName="MySql.Data.MySqlClient"-->
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<customErrors mode="Off"></customErrors>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
If you are bin-deploying/xcopying MySQL's Connector/Net provider, you may need to add the following fragment to your web.config
<system.data>
<DbProviderFactories>
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description="Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
</DbProviderFactories>
</system.data>