MySQL的实体框架错误 - 指定的存储提供不能在配置中找到,或者是无效的 [英] MySQL Entity Framework Error - The specified store provider cannot be found in the configuration, or is not valid

查看:282
本文介绍了MySQL的实体框架错误 - 指定的存储提供不能在配置中找到,或者是无效的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#编写的组件来执行的MySQL数据库所有的数据访问。我已经成功地在我的C#的WinForm桌面应用程序中使用的组件(编译DLL)。但它仅适用于那些有的MySQL Connector净6.4.4安装电脑。

我试图用同样的组装与我的asp.net网站项目。首先,我得到了有关缺失连接字符串错误。这是很容易将MySQL的连接字符串的web.config文件解决。现在我得到这个错误(堆栈跟踪下面列出),我曾尝试加入以下的dll到我的bin文件夹来解决它,但它没有工作。

  MySql.Data.dll
MySql.Data.Entity.dll
MySql.Web.dllSystem.Web.HttpUnhandledException(0x80004005的):类型System.Web.HttpUnhandledException的异常被抛出。
---> System.ArgumentException:指定的存储提供不能在配置中找到,或者是无效的。
---> System.ArgumentException:无法找到所请求的.NET Framework数据提供程序。它可能没有安装。在System.Data.Common.DbProviderFactories.GetFactory(字符串providerInvariantName)在System.Data.EntityClient.EntityConnection.GetFactory(字符串providerString)
---内部异常堆栈跟踪的结尾


解决方案

  

但它仅适用于那些有的MySQL Connector 6.4.4净的PC安装。


这是不是意味着您要运行的机器上未安装该提供的code?在这种情况下,你还必须注册商在您的配置文件,因为安装添加它的Machine.config,如果你没有安装它的供应商,目前未注册。

尝试添加到您的web.config文件:

 <&System.Data这GT;
  < D​​bProviderFactories>
    <添加名称=MySQL的数据提供程序
         不变=MySql.Data.MySqlClient
         说明=用于MySQL的.NET Framework数据提供程序
         键入=MySql.Data.MySqlClient.MySqlClientFactory,MySql.Data,版本= 6.4.4.0,文化=中性公钥= c5687fc88969c44d/>
  < / DbProviderFactories>
< /system.data>

I have written an assembly in C# to perform all data access for a MySQL database. I have successfully used the assembly (a compiled dll) in my C# winform desktop application. But it only works on PCs that have had the "MySQL Connector Net 6.4.4" installed.

I tried to use the same assembly with my asp.net Website project. Firstly I got an error about a missing connection string. This was easily solved by adding the MySQL connection string to the web.config file. I now get this error (stack trace listed below), I have tried adding the following dlls to my bin folder to resolve it but it didn't work.

MySql.Data.dll
MySql.Data.Entity.dll
MySql.Web.dll

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. 
---> System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. 
---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed. at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) at System.Data.EntityClient.EntityConnection.GetFactory(String providerString) 
--- End of inner exception stack trace 

解决方案

But it only works on PCs that have had the "MySQL Connector Net 6.4.4" installed.

Does it mean that you are trying to run your code on machine where the provider is not installed? In such case you must also register the provider in your configuration file because installation adds it to machine.config and if you didn't install it the provider is currently not registered.

Try to add this to your web.config file:

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

这篇关于MySQL的实体框架错误 - 指定的存储提供不能在配置中找到,或者是无效的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆