A personal repository of technical notes. - CSC

Could not open a connection to SQL Server in ASP.NET on Windows 7 x64 IIS 7

Problem

While developing an ASP.NET website on a local Windows 7 x64 IIS 7 machine, received the following error:

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)

However, a connection could be opened using SQL Server Management Studio (SSMS) with the same credentials used by the website.

Solution

Set up server alias in 64-bit version of SQL Native Client Configuration using Sql Server Configuration Manager. The reason that SSMS was working was because it was using the 32-bit aliases set up at an earlier time.

No comments:

Post a Comment