470,601 Members | 1,276 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,601 developers. It's quick & easy.

Problem Connecting .NET app to SQL Server


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.


Apr 3 '08 #1
2 2848
orandov (or*****@gmail.com) writes:
I imagine the issue is somehow related to the company's firewall but
why would it only block Windows Server 2003 and not XP?
Some firewall could be set up to accept the IP address of your XP
box, but not the application server. Apparently, you are able to ping
the db server from the app server, but the firewall on the db server
may not be open to everyone on port 1433. (You said it was on port 1402,
but maybe you looked in the wrong place? The best place to look is
the SQL Server errorlog.) Also check UDP 1434.

Also, when you tried using port 1402 in the connection string, how
did you actually do it?

Not a very conclusive response, but issues like these are difficult to
diagnose on a distance.

Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
Books Online for SQL Server 2000 at
Apr 3 '08 #2
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.

Apr 4 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dmitry Akselrod | last post: by
2 posts views Thread by John | last post: by
reply views Thread by Suresh | last post: by
reply views Thread by NoaGross | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.