连接MySQL数据库得到错误“Unable to find the requested .Net Framework Data Provider”
2014-11-10 18:53
561 查看
Registering DbProviderFactories
Each .NET Framework data provider that supports a factory-based class registers configuration information in the DbProviderFactories section of the machine.config file on the local computer. The following configuration file fragment shows the syntax and format for System.Data.SqlClient.<system.data> <DbProviderFactories> <add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </DbProviderFactories> </system.data>
The invariant attribute identifies the underlying data provider. This three-part naming syntax is also used when creating a new factory and for identifying the provider in an application configuration file so that the provider name, along with its associated connection string, can be retrieved at run time.
我下载MySQL连接器/净6.7.4和Visual Studio 1.0.2 MySQL随后,然后这些指令测试:
创建一个连接到现有的MySQL数据库。
创建一个控制台应用程序。
添加麻烦。网络实体数据模型从现有数据库连接。
添加代码生成项EF 5。x DbContext发生器,取代了。tt文件。
编写一些代码,从数据库中检索记录。
运行应用程序时,我得到了这个异常:
ConfigurationErrorsException:没有找到或加载注册。净框架数据提供商。
然后我添加引用
MySql.Data和
MySql.Data.Entity6.7.4.0我库版本。NET 4.5项目。现在,当运行应用程序时,我得到一个不同的异常:
FileLoadException:无法加载文件或组装的MySql。数据、Version = 6.6.5.0 c5687fc88969c44d文化=中立,不能删除!请教如何解决这个问题”或它的一个依赖项。位于议会的清单定义不匹配装配参考。(从HRESULT例外:0 x80131040)
注意版本号,这不是MySQL连接器,我已经安装的版本。
我如何得到它正常工作?
诀窍解决这是:
添加引用
MySql.Data和
MySql.Data.Entity库(6.7.4.0正确的版本。NET 4.5,在我的例子中)这一项目。
编辑
machine.config与你的编辑器以管理员身份运行,和替换出现的所有MySQL版本
6.6.5.0通过
6.7.4.0.
第二步,注意,有多个
machine.config文件,一个用于每个框架版本(3.0,3.5,4.0)和结构(32位,64位)。还要注意的是
machine.config文件。NET 4.5的。NET 4.0文件夹。你可以找到的
machine.config文件:
C:\Windows\ Microsoft.NET \ Framework \ \配置
和:
C:\Windows\ Microsoft.NET \ Framework64 \ \配置
如果没有对MySQL的引用
machine.config文件,您可能没有安装MySQL为Visual Studio。这样做,或添加以下的
app.config您的项目的文件:
<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.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories> </system.data>
相关文章推荐
- ASP.NET使用MySQL数据库得到错误Unable to find the requested .Net Framework Data Provider
- entity framework 连接 oracle 发布后出现的问题(Unable to find the requested .Net Framework Data Provider)
- Unable to find the requested .Net Framework Data Provider. It may not be installed
- Unable to find the requested .Net Framework Data Provider. It may not be installed
- Unable to find the requested .Net Framework Data Provider
- mysql 找不到或无法加载已注册的 .Net Framework Data Provider和Unable to find the requested .Net Framework Data Provider. It may not be installed解决
- [SSMS][Visual Studio] 解決 - Unable to find the requested .Net Framework Data Provider. It may not be installed
- .Net Framework Initialization Error – Unable to find a version of the runtime to run
- c#连接mysql数据库时 找不到或无法加载已注册的 .Net Framework Data Provider
- .Net Framework Initialization Error – Unable to find a version of the runtime to run this applicati
- .Net Framework Initialization Error – Unable to find a version of the runtime to run this applicatio
- .Net Framework Initialization Error – Unable to find a version of the runtime to run this applicatio
- 黄聪:.Net Framework Initialization Error – Unable to find a version of the runtime to run this application解决方案
- Net Framework Initialization Error – Unable to find a version of the runtime to run this applicatio
- .NET版本问题 转[.Net Framework Initialization Error – Unable to find a version of the runtime to run this applicatio]
- Android问题集锦之九:Unable to find a 'userdata.img' file for ABI armeabi to copy into the AVD folder.
- 创建虚拟机错误解决:Unable to find a 'userdata.img' file for ABI x86 to copy into the AVD folder.
- "BEA-000450" "Unable to find internal data record for the socket"
- ADO.NET实体框架连接串引发的异常:Unable to load the specified metadata resource
- ADO.NET实体框架连接串引发的异常:Unable to load the specified metadata resource