I am having a problem connecting my .net applications from the application server to the database server. When I run the application from my windows xp (sp2) box it works fine. When I try to connect via SQL Management Studio to the database server from the application server I get the same error.
Here is the error:
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)
Here is the Environment:
Windows Server 2003 Standard Edition
Inside Company's Firewall/ Network
Windows Server 2000 Advanced Edition
SQL Server 2000 SP4
Remote Connections to the Server is checked
Enable Protocols: Named Pipes & TCP/IP
TCP/IP Port: 1402 (I don't know why it isn't the default of 1433)
The db server is sitting out side the Company's firewall (don't ask me why). I can access it fine from inside the firewall on my XP box but not from windows server 2003. There is a web server outside the our network that also connects to the db server with no problem and that is running Windows Server 2003 Web Edition.
I can ping the db server from the app server using the IP address.
I tried using the IP address and the port 1402 in my connection string but that didn't work from any machine (XP and Server).
I imagine the issue is somehow related to the company's firewall but why would it only block Windows Server 2003 and not XP?
What do I tell the network admin to change?
Any help would be appreciated.
You requested that we don't ask why you have a DB server outside your firewall, so I won't, but let me tell you the temptation is really strong.
Now, If *I* were your network admin, I would have different segments on the firewall for servers, clients, and the internet at a minimum. Again, I don't have any information about your firewall configuration, so ask your network admin the following:
I hope that helps pointing you in the right direction. There's still a lot of unknown variables to solve for given the problem description...
Best of luck,
Thanks for the suggestions. I will talk to the network admin and see what we can do.
I can't answer the million dollar question as to why the DB server is outside the firewall b/c I don't know. The true is that nobody left in the company knows the real reason. The people who deemed it necessary are no longer with the company anymore and I just got here. However we are planning on moving it into the firewall after we analyze the processes and systems that communicate with the server.
I let the visual studio dialog build the connection string for me with the IP Address and now it is working with port 1402.
What I am still puzzled by is that SQL Server Management Studio & Enterprise Manager (on a Windows Server 2003) can't connect to the Server with only the server name and it requires the IP Address but on my XP workstation it works fine with only the server name.
My network admin says there is no difference in the way the Windows Servers are set up on the network than the XP workstations.
Thank for your help.
In SQL 2005 you have to explicitly grant remote connections. You can set this in configuration manager or surface area configuration:
Allow TCP/IP connectons
Set up Alias