Can't Connect .Net application from Windows Server 2003 to Database Server (SQL Server 2000)


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:

App Server:

Windows Server 2003 Standard Edition

Inside Company's Firewall/ Network

Database Server:

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.




4/3/2008 7:18:42 PM
📃 29906 articles.

💬 4 Replies

Hello Oran,

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:

  • Are your XP client and the 2003 App server on different segments on your firewall? If so, are there rules applied to the server segment blocking bidirectional connection to the db server?
  • Are your client and the app server on different subnets as far as the firewall is concerned, and if so are there rules in the rule sets that would prevent the app server from establishing a bidirectional connection to the db server?
  • Does **** see any log activity on the firewall indicating that packets from the app server to the db server, or from the db server to the app server are being blocked?
  • Why are there any servers outside the company firewall? (Sorry, I couldn't resist...)

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,




"Give a man a fire and he'll stay warm for a day.
Set a man on fire and he'll stay warm for the rest of his life."
4/3/2008 8:26:02 PM

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.


4/3/2008 8:43:27 PM

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.


4/4/2008 7:29:19 PM

 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 

4/4/2008 7:37:15 PM