c# - 不变名称为 'MySql.Data.MySqlClient' 的 ADO.NET 提供程序未在计算机或应用程序配置文件中注册

标签 c# mysql entity-framework ado.net

当我在我的电脑上执行此操作时,我的程序工作正常,但是当其他人尝试在他们的电脑上打开它时,它将打开第一页,但当他们单击“登录”时,程序可能需要开始使用数据库他们收到此错误

enter image description here

我重新安装连接器,执行 PM>Install-Package EntityFramework 并尝试检查 app.config,但对我来说它看起来不错。我还有 EntityFramework.SqlServer.dll - copy Local - true 这应该是正确的。

这是我的应用程序配置


<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>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
  </startup>
  <connectionStrings>
  <add name="Database" connectionString="metadata=res://*/DatabaseModel.csdl|res://*/DatabaseModel.ssdl|res://*/DatabaseModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=XXX;user id=XXX;password=XXX;persistsecurityinfo=True;database=XXX;allowuservariables=True&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDatabaseModelConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0" />
      </parameters>
    </defaultConnectionFactory>
    <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.EntityFramework, Version=8.0.17.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
    </providers>
  </entityFramework>
  <system.data>
  </system.data>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.17.0" newVersion="8.0.17.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

最佳答案

他们的计算机上可能没有安装任何 MySql 连接器。 通过安装 nuget 修复它:MySql.ConnectorNET.Entity

enter image description here

关于c# - 不变名称为 'MySql.Data.MySqlClient' 的 ADO.NET 提供程序未在计算机或应用程序配置文件中注册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58697929/

相关文章:

c# - ChannelReader 完成任务在 OperationCanceledException 之后永远不会完成

mysql - SQL 对于给定的主键,我想添加匹配的数据

mysql - 如何正确地将 mariadb 数据库从容器移动到主机

php - Laravel 中按多态关系对数据库结果进行排序

entity-framework - Entity Framework : create one-to-one relation to itself

c# - LINQ 分组依据然后显示 (dd mmm) 的日期时间

c# - Reflection.Emit 实现接口(interface)的泛型方法约束

c# - 递归正则表达式以匹配键和名称

c# - 不能使用 columnwidth excel 属性

wcf - Microsoft 在其产品中使用 WCF 或 EF 吗?