.net框架:4.7.2
mysql服务器安装:8.0.12
mysql连接器/net:8.0.12
实体框架:6.2.0
mysql.data:8.0.12
mysql.data.entityframework:8.0.12
web.config配置
<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.MySqlProviderServices,
MySql.Data.EntityFramework, Version=8.0.12.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="DefaultConnection"
connectionString="server=localhost;user=root;database=app;password=root;"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<providers>
<provider invariantName="MySql.Data.MySqlClient"
type="MySql.Data.MySqlClient.MySqlProviderServices,
MySql.Data.EntityFramework, Version=8.0.12, Culture=neutral,
PublicKeyToken=c5687fc88969c44d"/>
</providers>
连接到db时,出现如下异常: The requested .Net Framework Data Provider's implementation does not have an Instance field of a System.Data.Common.DbProviderFactory derived type.
1条答案
按热度按时间jjjwad0x1#
中的配置信息
<DbProviderFactories>
不正确。根据mysql connector/net文档,它应该是: