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)
Hello I am new on developing on SQL Server 2005. I've worked for several years with SQL Server 2000, but after doing the usual stuff I do to connect to the server I get this exception on the web server.
There are several links on google that point me to possible solutions, but none of them have solved my problem. I've made changes on a "Surface Area whatever..." dialog (What the hell is that??? Why does SQL Server has changed so much??? It seems so complicated now).
I have ensured that SQL Server 2005 is configured properly to allow incoming connections on the instance of database server. I also have selected Automatic as the Startup type to start SQL Server Browser service automatically every time system starts. And no, there is no firewall running.
I've tried changing the connection string to connect using a port, to connect using the IP, to connect using the instance name...
Nothing seems to work, I'm still getting the same error. Any hint?
Answering the questions that people have made: Yes, I can connect using management studio from a different computer. Yes, I'm sure it's configured to accept local and remote TCP/IP and named pipes. Yes, I restarted the server.
I am using Mixed mode security, which I already enabled. I already enabled the sa user. I am able to connect to the database using a .udl file, and I've checked that my connection string is OK. I can connect to the database using DBArtisan and SQL Server client tools. I can do that both on the server and on a different machine. Even with all that...
The website is still unable to connect.
New update... I've been struggling all day with this problem, and still haven't found out the cause. It seems that the error message I posted is a generic error that .net gives when it's not able to connect. I placed trash on the connection string (typing servers that don't exist) and I still get the same error.
These are some of the connection strings I've used on the server:
connectionString="Integrated Security=SSPI; Data Source=SERVER; Initial Catalog=db; Network Library=DBMSSOCN;"
connectionString="Data Source=SERVER; Initial Catalog=db; User ID=sa; Password=xxxxx;"
connectionString="Data Source=SERVER\MSSQLSERVER; Initial Catalog=db; User ID=sa; Password=xxxxx;"
I tried to register the sql server instance using some strange command, I found that here: http://kb.discountasp.net/article.aspx?id=1041 To do that I used the aspnet_regsql.exe tool. It's still not working...
I also know that the server has the latest version of MDAC installed on it. The only thing that I'm suspicious on is that the server has two Database engines: SERVER and server\sqlexpress
Does that has something to do with the problem?