我在Web服务器上有两个ASP.NET网站,还有两个SQL Server数据库。错误:40 - 无法打开连接到SQL Server - 只在登台网站上
我有一个网站#1的文件夹,它包含一个带有指向数据库#1的连接字符串的web.config。
在网站#1的文件夹下有一个名为'staging'的临时文件夹,其中包含网站#2,并且web.config中有一个指向数据库#2的连接字符串。
网站#1完美运作。
但是当我尝试运行网站2,我总是得到以下错误:
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)
我已验证连接字符串是正确的,它指向数据库#2。
但即使当我交换来自网站#1的连接字符串时,它在网站1上完美工作,它仍然失败。
下面是连接字符串的样子:
<connectionStrings>
<add name="WebsiteConnectionString" connectionString="Data Source=localhost;Initial Catalog=WebsiteStaging;User Instance = false;User Id=xxxx;Password=yyyy" providerName="System.Data.SqlClient" />
</connectionStrings>
有什么不寻常的事情在这里,我不知道的?
好吧,好消息是:您发现问题及其解决方案 – 2009-09-08 04:24:46