0
点赞
收藏
分享

微信扫一扫

ADO.NET Entity framework 连接MySql 提示The specified store provider cannot be found in the configuration

NicoalsNC 2023-09-18 阅读 31


本机安装了 MySql Connector/Net 6.9.6



http://dev.mysql.com/downloads/connector/net/


ADO.NET Entity framework 连接MySql 提示The specified store provider cannot be found in the configuration_MySQL




使用ADO.NET Entity framework操作MySql数据库,没问题,但是复制到其他主机上运行则提示The specified store provider cannot be found in the configuration...


查找资料,发现在项目里的App.Config添加一下代码得以解决(如下代码),其中 <remove invariant="MySql.Data.MySqlClient"/>是为了在已安装了MySql Connector/Net的主机上运行不报错,同时注意修改Version


<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.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>



在安装好的MySql Connector/Net目录下复制你项目使用的.Net Framework版本对应的DLL,如下图




ADO.NET Entity framework 连接MySql 提示The specified store provider cannot be found in the configuration_ide_02




拷贝 MySql.Data.dll、MySql.Data.Entity.dll、MySql.Web.dll到你项目的Bin目录下,到此,打包时附带上这三个Dll,其他电脑在运行你的软件时,无需再额外安装MySql Connector/Net。


举报

相关推荐

0 条评论