Question

I've been pulling my hair out over this one. I have a legacy app (asp.net 2.0) that I have just moved to a different machine and I am trying to connect it to a SQL Server 2000 database on the SAME machine, but it is failing every time with the general 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.

What is weird is this is only .net apps (windows or web). I can connect just fine - using windows or SQL server authentication - from Enterprise Manager, Query Analyser, Server Explorer in visual studio. This also works just fine on an XP machine, this new setup in on Win 7

  • I've checked that TCPIP is enabled for the SQL Server and it is listening on port 1433.
  • The server is setup for mixed mode authentication. I have tried both methods of trying to connect. I even removed mixed mode and just tried windows authentication and it still did not work.
  • I have double checked I am using the right server name\instance name and correct credentials.
  • Port 1433 is open on the firewall (not that it matters - same machine)
  • I have rebooted, checked services etc - as I said, I know it is running because I can connect by other means.

Any ideas? What would be different about essentially using a connection string through ADO.NET?

UPDATE: Well that was almost funny - I found out how to answer it here a few minutes after posting this question (though I didn't realise it was related before): How to specify a port number in SQL Server connection string?.

This new machine already had SQL Server 2008 Express installed before 2000 got put on and even though 2000 'says' it is listening on 1433, it probably is not. Anyway, I changed the default port for my 2000 installation (to 1633 at random) then changed the connection string from server name\instance name to server name,port. And it loaded.

Hopefully this will prevent someone having the last few hours I just did....

Was it helpful?

Solution

Answered this with some more research on this site a few minutes later: please see question update for details!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top