Problem Connecting .NET app to SQL Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • orandov

    Problem Connecting .NET app to SQL Server

    Hi,

    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.Sql Client.SqlExcep tion: 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.

    Thanks,

    Oran
  • Erland Sommarskog

    #2
    Re: Problem Connecting .NET app to SQL Server

    orandov (orandov@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, esquel@sommarsk og.se

    Books Online for SQL Server 2005 at

    Books Online for SQL Server 2000 at

    Comment

    • orandov

      #3
      Re: Problem Connecting .NET app to SQL 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.

      Oran

      Comment

      Working...