Sql – Stop Linq2SQL using Named Pipes

linqlinq-to-sqlsql

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

Best Answer

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 />
Related Topic