ASP.NET连接MySQL数据库得到错误“Unable to find the requested .Net Framework Data Provider. It may not be installed
如果你开发的程序是asp.net + mysql数据库,发布到服务器上,可能会得到如下错误:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
具体解决办法是:
1. 在你本地找到文件Mysql.Data.dll,上传到网站的bin目录下。
一般都装了MySQL .NET connector,那个dll会在路径C:\Program Files\MySQL\MySQL Connector Net 6.0.3\Assemblies
2. 编辑web.config文件,进行Data Provider的定义,拿版本6.0.3.0举例
根据自身情况,添加以下代码
<system.web>
<compilation debug="true" urlLinePragmas="true">
<assemblies>
<add assembly="MySql.Data,Version=6.0.3.0, Culture=neutral,PublicKeyToken=C5687FC88969C44D"/>
</assemblies>
</compilation>
</system.web>
<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.0.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
评论已关闭