views:

267

answers:

3

I have a nice little Linq2SQL project however when deployed the database is on another server. I keep getting a named pipe error that the remote server doesn't exist - yet it does, it has Named Pipes enabled (protocol + surface) SQL 2005. TCP connections work fine.

I've tried setting the library in the connection string to a TCP one, I tried forcing TCP in the server name however Linq is always and only using Named Pipes and just won't work.

Any idea how to force Linq2SQL to use TCP/IP only, if possible?

thanks

A: 

My guess is that you are not setting the connection string to None on the DBML designer file which is creating the typed data context for you. Set the connection string to None (make sure nothing on the designer is selected) and then pass in the connection string manually, to assure that you have complete control over it.

As noted in the comments, you can't set the connection string to none.

In this case, there is still an overload of the typed DataContext which takes a connection string as a parameter. I would recommend using a hard-coded one first to see if it works. If it does, then you know it is the resolution of the item from the config file. Otherwise, you know to look at the connection string itself.

Also, if it is a problem with resolution in the config file, I usually place this in my connection string section FIRST to clear entries from the machine.config file:

<clear />
casperOne
You are right, we won't set it to none - we need it in there and it is just a connection string from the app.config file.
typemismatch
A: 

How about changing the protocol order in the SQLConfiguration manager or using the command tool, cliconfig on the client and changing it there.

Sunit
A: 

I've seen this happen when (any of these):

  • The SQL client version isn't the one you expect
  • Windows Authentication is being used, often unintentionally
  • The connection information you provide doesn't match with the server's own name. (That is, select @@server_name doesn't return the same as the NETBIOS name. Fix using sp_dropserver and sp_addserver)

Sometimes reinstalling MDAC on the client machine helps, apparently because the driver looked like it was there but wasn't fully working.

Hope this helps...

Bruce