发布了一个程序到服务器,获取数据的时候抛异常,异常信息如下:
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 Sys.Common.DbHelper.CreateConnection(String nameOrConnectionString, String providerName) in e:\jxProject\CRM\JXian\Sys\Sys.Common\Helper\DbHelper.cs:line 62
at Sys.Common.DbHelper.CreateOpenConnection(String nameOrConnectionString, String providerName, TransactionScopeType scopeType) in e:\jxProject\CRM\JXian\Sys\Sys.Common\Helper\DbHelper.cs:line 159
at JiuXian.FBS.Data.Implement.ClaimsManageProvider.GetGoodsBasePrice(ClaimsModel mod, String& strMessage) in e:\jxProject\CRM\JXian2.0\FBS\FBS3.3\JiuXian.FBS.Data\Implement\ClaimsManageProvider.cs:line 785
原因是没有注册mysql,以下在config文件中加如下配置,注册mysql,需要注意的是mysql的版本(Version=6.6.6.0,)需要和你引入的mysql的mysql.dll组件版本一致
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient"/>
<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.6.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>