2

On my prod server, I have 2 instances of SQL server, SQL Server 2000 is the default instance, and I have \SQLEXPRESS2008 as an additional named instance. In my web project, I need to connect to the default, SQL 2000 instance.

I'm using LINQ to SQL in Visual Studio 2008.

In the Server Explorer in Visual Studio, I can create a connection to the DB, see all the tables, correctly generate the LINQ to SQL classes, etc.

In Management Studio I can connect to the DB, see everything, edit, etc.

When I try and run my web project code, however, I get:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

My connection string in the web project looks like:

<add name="myConnectionString" connectionString="Data Source=myServer.com;Initial Catalog=myDB;Persist Security Info=True;User ID=sa;Password=XXXXX" providerName="System.Data.SqlClient" />

(I'm testing with the sa account out of desperation).

I have other web projects running fine and utilizing the DB, but this is the only one using the LINQ to SQL classes (if that matters)

Help appreciated

Jonathan

1
  • "I have other web projects running fine and utilizing the DB", I presume these are not hosted on the production DB server? Commented Nov 19, 2010 at 5:41

2 Answers 2

1

If the web server is the same as the SQL server, just use . as the server name; much simpler.

If the web server us not the same as the SQL server, ensure that there is line-of-sight between these servers through any firewalls etc. Also ensure that the server name resolves (in many ways, it is simpler to use the IP address in the connection string if name resolution cannot be guaranteed).

Sign up to request clarification or add additional context in comments.

Comments

1

This may be the same thing that happened to me and is one of the most annoying things about LINQ to SQL. Each time you make a change to your dbml, it reverts to the connection used by the server explorer in VS. You must right-click the design surface then manually change the connection back to "myConnectionString", recompile and run.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.