繁体   English   中英

具有不变名称“MySql.Data.MySqlClient”的 ADO.NET 提供程序未在机器或应用程序配置文件中注册

[英]The ADO.NET provider with invariant name 'MySql.Data.MySqlClient' is either not registred in the machine or application config file

我的程序在我的 PC 上运行时运行良好,但是当其他人尝试在他们的 PC 上打开它时,它会打开第一页,但是当他们单击“登录”并且程序可能需要开始使用数据库时,他们会得到这个错误

在此处输入图像描述

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

这是我的 app.config


<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 修复它

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM