Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm getting the following error when trying to load an Asp.NET MVC App on IIS 7 with Sql Server 2008 Express. The App uses Linq to SQL.

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)

I've done some searching and all answers point to enabling TCP connections in Sql Server Configuration which I have done to no avail.

The connection string I am using is:

Server=SERVERNAME\SQLEXPRESS;Database=DBName;Integrated Security=true

The catch. I have another app that already could talk to the Sql Server just fine. Even before playing around with the Sql Server Configuration Settings.

The other app uses the following connectionstring:

Data Source=SERVERNAME\SQLEXPRESS;Initial Catalog=OtherDbName;Integrated Security=True;Persist Security Info=False;Connect Timeout=120

I've tried this connectionstring on the app that isn't working and it still doesn't work.

Please help. I think i'm about to go crazy

share|improve this question
Your app that works - is it on the same box as the one that currently doesn't? – Dave Holland Dec 16 '09 at 15:10
Yes, the both are on the same box. Also, the SQL Server is local as well. – sf Dec 16 '09 at 16:10

2 Answers

When you use integrated auth it will run as your sites' app pool. Check the app pool identity and ensure that it has necessary permissions to the database.

Also, any chance that a different version of ASP.NET may be using a different database driver default (rare put possible). Just to mix it up, here's another standard connection string: "Data Source=servername\sqlexpress;Initial Catalog=DBName;Integrated Security=SSPI;" It should be equivalent to what you have though.

share|improve this answer

I'm facing the exact same issue. MVC, Linq to SQL, IIS7, An existing site that is able to connect, and the new site is throwing that same error.

Did anyone ever come up with a solution? I'm running out of ideas!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.