2

I have a MVC5 Project, using MySQL.Data.Entity.EF6, that I am attempting to load using Kestrel (DNX).

However, I continue to get this error on Page Load:

MetadataException: Schema specified is not valid. Errors: 
CMaxModel.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET 
provider with invariant name 'MySql.Data.MySqlClient'. Make sure the provider is 
registered in the 'entityFramework' section of the application config file. See 
http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

I have created my DbContext using this configuration:

public class MyDbConfiguration : DbConfiguration
{
    public MyDbConfiguration()
    {
        // Register ADO.NET provider
        var dataSet = (DataSet)ConfigurationManager.GetSection("system.data");
        dataSet.Tables[0].Rows.Add(
            "MySQL Data Provider",
            ".Net Framework Data Provider for MySQL",
            "MySql.Data.MySqlClient",
            typeof(MySqlClientFactory).AssemblyQualifiedName
        );

        // Register Entity Framework provider
        SetProviderServices("MySql.Data.MySqlClient", new MySqlProviderServices());
        SetDefaultConnectionFactory(new MySqlConnectionFactory());
    }
}


[DbConfigurationType(typeof(MyDbConfiguration))]
public partial class CMax : DbContext
{
    public CMax(string connectionString)
        : base(connectionString)
    {
    }

Even tho from what I've read that MVC doesn't use web.config, in the wwwroot, I have even entered into the Web.Config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v12.0"/>
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
      </provider>
    </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.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
    </DbProviderFactories>
  </system.data>

  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%"     stdoutLogEnabled="false" startupTimeLimit="3600"/>
  </system.webServer>

</configuration>

I am at a complete loss, any help would be appreciated.

miken32
  • 42,008
  • 16
  • 111
  • 154
Adam Reed
  • 123
  • 6
  • Possible duplicate of [No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider](http://stackoverflow.com/questions/15142841/no-entity-framework-provider-found-for-mysql-data-mysqlclient-ado-net-provider) – miken32 Dec 22 '15 at 22:15
  • 1
    Unfortunately, it isn't. Mine is specific to MVC5, as well as Kestrel. Thanks tho. – Adam Reed Dec 23 '15 at 14:26

0 Answers0