10

How can I force my ASP.Net application to connect to a SQL Server using TCP/IP, not Named Pipes?

I read somewhere putting "tcp:" in front of the server name in the connectionstring should do the trick, but it does not seem to change anything.

Edit1:

  • TCP/IP is enabled on the SQL Server.
  • I tried Network Library=dbmssocn in the connectionstring, I still get an errormessage about named pipes: "provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server"

Edit2:

  • Turns out my problem was another hidden connectionstring used by entity framework
Community
  • 1
  • 1
Kjensen
  • 12,447
  • 36
  • 109
  • 171

4 Answers4

26

You can force it in the connection string:

server=tcp:hostname

Via: http://weblogs.asp.net/jgalloway/archive/2007/02/24/sql-force-the-protocol-tcp-named-pipes-etc-in-your-connection-string.aspx

Hardwareguy
  • 2,941
  • 1
  • 17
  • 13
4

Use the SQL Server Configuration Manager on the client and disable the client protocols you don't want it to use.

David McEwing
  • 3,320
  • 18
  • 16
  • By client machine, do you mean the web server? That does not even have SQL Server installed. – Kjensen Jun 11 '09 at 21:05
  • I mean the client machine. You can install just the connectivity components. Or you can disable namedpipes on the server. Eitherway you'll end up connecting by TCP. – David McEwing Jun 11 '09 at 21:26
  • 1
    This solution doesn't provide an answer programmatically and it doesn't work if a developer doesn't have access to the GUI on the client machine. – bbqchickenrobot Dec 27 '09 at 20:40
0

Just to add a quick hint, could cause issues, if you need to specify a port, do it after the IP address, and use a comma, not a colon.

Sean Haddy
  • 1,630
  • 1
  • 16
  • 25
0

It depends how you're connecting to the database, but this should give the information you need.

ggponti
  • 395
  • 5
  • 9