Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a local .mdf database with Visual Studio 2010 and did a couple of modifications to it. Now I want to edit it in IIS Manager. However, I cannot access it neither by connection string, nor by direct specification.

First. I copied a connection string from Visual Studio 2010 properties window for the DB, it was like Data Source=.\SQLEXPRESS;AttachDbFilename=o:\...\MyDB.mdf;Integrated Security=True;User Instance=True. I went to IIS Manager -> Connection Strings -> Add -> Custom and pasted it. Then went to IIS Manager -> Database Manager -> MyDB, it opened, but there were no visible contents while I've added several tables.

Second. I used "Add Connection" in Database Manager and specified properties like following:

  • Database provider == SQL Server 2008
  • Server == localhost
  • Database == o:...\MyDB.mdf
  • User ID == my_local_user_name

But when I accessed newly created connection, I got the following error:

There was an error while performing this operation. Details:

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)

Same if I set Server field to SQLEXPRESS. Any ideas?

  • Windows 7 x64 Ultimate
  • Microsoft SQL Server 2008 x64
  • Visual Studio 2010 Professional SP1
  • IIS Manager x64
share|improve this question

Don't use the AttachDbFileName syntax of the connection string. Just attach the database to the SQL Server instance and log into the instance as normal. Once you get your app out to the hosting provider they aren't going to let you use this syntax anyway as the SQL Server will probably be sitting on another server.

Are you able to make a connection to the local SQL Server instance?

share|improve this answer

Open up SQL Server Configuration Manager and ensure that Named Pipes, in Network Configuration > Protocols, is enabled. You may also want to edit the TCP/IP properties to change it from a using a dynamic TCP/IP port to a static port.

share|improve this answer
Named Pipes are enabled. And I don't really think this error message is relevant. Apparently, I have some more general error resulting in this message. – Mikhail Aug 7 '12 at 10:17

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.