An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, This failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
If you are new to .net you will surely face the following error.
Solution for the error as follows
Follow the pathStart -> All Programs
-> Microsoft SQL server 2005
-> Configuration Tools
->SQL Server Surface Area Configuration

Now you will be land to SQL Server 2005 Surface Area Configuration window.
Now Click
Surface Area Configuration for Services and Conditions(2nd bottom).

Soon you will land to SQL Server 2005 Surface Area Configuration window
Goto
DataBase Engine -> Remote Connections
By Default Local Connections only will be selected.
Change it by selecting Local and remote connection.
Options under Local and remote connection will be by default Using TCP/IP only.
Select the last option
Using both TCP/IP and named pipes.
click apply and then ok.
Dont Forget to Restart SQL Server.
No comments:
Post a Comment