【发布时间】:2012-03-19 06:48:14
【问题描述】:
我正在尝试连接到我的网络服务器上的 mysql 数据库,但我不断收到:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
我猜测 ADO.NET 连接器存在,因为如果我将配置更改为:
providerName="System.Data.SQLClient"
我明白了:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
我的提供商配置是:
<add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.0.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
autogenerateschema="true" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
我的连接字符串是:
<add name="LocalMySqlServer"
connectionString="Data Source=localhost;user id=web210-aaron;password=tester;database=web210-aaron;"
providerName="System.Data.MySQLClient"/>
我很确定这是正确的,尤其是当我从本地计算机运行它(将主机更改为服务器 IP)时,它运行完美!有人可以确认这是一个正确的连接字符串。
【问题讨论】:
-
您是否添加了对包含
System.Data.MySQLClient的程序集的引用? -
我可能不理解您的情况,但是当您将提供程序名称更改为 System.Data.SQLClient 时,它仅表明可能安装了 SQL Server 提供程序。这并不意味着安装了 MySQL 提供程序。
-
@MarkWilkins 我以为它们都是同一个 ADO 连接器的一部分?我确实在我的本地机器上添加了对程序集的引用,但我无法将它安装在服务器上......我不这么认为
-
我不太清楚您所说的“ADO 连接器”是什么意思,但是这两个竞争数据库服务器的 .NET 数据提供程序可能不会在同一个安装包中。你当然可以同时安装它们,但我认为它总是需要两个单独的安装包。
标签: c# asp.net mysql asp.net-mvc-3 ado.net