asp.net connection to SQL 2005 database error prompted: An error occurred while establishing a connection to the server. When you connect to SQL Server 2005, this failure may be caused by SQL Server not allowing remote connections under the default settings. (provider: Named pipe provider, error:40-cannot open a connection to SQL Server)
Workaround:
1, to ensure that the user name and password to use the connection can correctly log on to SQL2005.
2, to ensure that the server-side database allows remote connection, login SQL2005 Enterprise Manager, right click on the local Database "Properties",
In the Server Properties dialog box that pops up, select Connect and check "Allow remote connections to this server (A)".
3. TCP/IP to open the SQL Server is allowed, and the 2005--Configuration tool--sql Server Configuration Manager is found in the Start menu, where SQL Server 2005 Network configuration under the MSSQLSERVER protocol below the TCP/IP and named Pipes are enabled.
Also note that the TCP/IP configuration allows you to configure the IPs and port numbers, and dynamic ports are not.
4. Configuring the SQL Server Perimeter Application configurator is allowed for remote connections, locate the Microsoft SQL Server 2005--Configuration Tool--sql the server perimeter Application configurator and open in the Start menu.
In the pop-up window, tap the "service and connectivity Perimeter configurator".
In the perimeter application configurator for Services and Connections dialog box, click: Mssqlserver--database engine--Remote connection, select local and remote connections on the right, and use TCP/IP and named Piese below.
At this point, if you do not modify the default port of MSSQL, you should solve the problem.