Take the 2-minute tour ×
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

closed as too broad by Tom O'Connor Aug 24 '13 at 6:56

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the 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
add comment

1 Answer

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
add comment