Mysql 错误:50-发生本地数据库运行时错误。在一个站点上工作,但在另一个站点上不工作

Mysql 错误:50-发生本地数据库运行时错误。在一个站点上工作,但在另一个站点上不工作,mysql,asp.net-mvc,iis,Mysql,Asp.net Mvc,Iis,因此,我有两个ASP.NETMVC网站部署到IIS。我有一个运行在端口80的默认网站上,另一个运行在端口8080上。你可以连接到这两个没有问题,但当我去登录到8080端口的网站,它给了我这个错误 A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Ve

因此,我有两个ASP.NETMVC网站部署到IIS。我有一个运行在端口80的默认网站上,另一个运行在端口8080上。你可以连接到这两个没有问题,但当我去登录到8080端口的网站,它给了我这个错误

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: SQL Network Interfaces, error: 50 - 
Local Database Runtime error occurred. Cannot create an automatic instance. 
See the Windows Application event log for error details.
这只发生在8080端口的网站上,两个网站上的文件完全相同。它们都连接到与这些网站位于同一台计算机上的同一数据库

连接字符串:

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-DaybreakRecordsArchive-20170113120202.mdf;Initial Catalog=aspnet-DaybreakRecordsArchive-20170113120202;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="daybreakEntities3" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=<username>;password=<pass>;persistsecurityinfo=True;database=cottonwood&quot;" providerName="System.Data.EntityClient" />


我解决了这个问题。在IIS中的“应用程序池”下,我必须将第二个网站标识的池设置为LocalSystem。它以前设置为ApplicationPoolIdentity。另一个问题是,应用程序数据中的.mdf文件连接到MSSQLLocalDB,但应用程序数据中的.mdf文件的文件名对于两个站点都是相同的。我更改了一个站点的文件名,并在web.config中修复了相应站点的连接字符串。现在它们都工作了。

你能显示你的连接字符串吗?我已经在问题中添加了连接字符串。请只发布相关的连接字符串以说明你的错误。不要发布不相关的配置。@CameronRodriquez您安装了MySQL连接器吗?asp.net站点需要顶部的帐户信息,底部的是我从中提取信息的个人数据库。我的猜测是,默认连接是在我登录时出现问题的连接,默认页面不需要我的第二个连接字符串中的任何内容,尽管我可能错了。这就是我将两者都包括在内的原因。