I’m diving head first into ASP MVC and am playing around with creating and manipulating a database. I did a search and found this tutorial for creating a database, however when I follow it, I get this error right at the start when trying to add a new database to my fresh, empty ASP MVC 2 project…
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: SQL Network
Interfaces, error: 26 – Error Locating
Server/Instance Specified)
The only requirement the tutorial mentioned was SQL Server Express, but when I went to download it, it said it was already installed. I’m assuming it was part of the VS 2010 RC I installed and am running. So I don’t know what else I need if I am missing something.
This is all new to me, so I’m sure I’m missing something obvious here and after I’m done posting this question, I plan to do some more research into the topic of databases and how they work with ASP MVC. In the meantime, I was you could help me answer a couple high level questions…
- What am I missing/forgetting to do that is causing this error?
- Any suggestions for good resources/tutorials that focus on using databases with ASP MVC? I’ve done a lot of database programming in the past, so I’m familiar with the concepts of relational databases and the SQL language. I wish I could find a good resource for learning how to work with them in an ASP dev environment, as well as a good breakdown of all the related technologies used for working with them (i.e. LINQ to SQL).
Thanks so much in advance for all your help! I’m going to start researching these questions right now.
You need to verify that the connection string used by VS points to a valid and running SQL Server instance. Unless you modified something, VS will try to connect to a local instance named SQLEXPRESS (ie. a connection string with a datasource
.\SQLEXPRESS). You need to make sure that your SQL Server is running in an instance named SQLEXPRESS. Run from a command promptnet start mssql$sqlexpressto start the service if its stopped. You also need to make sure you can connect to said SQL Server instance: see if starting VS as an administrator makes any difference. If it does, then you need to add yourself to the SQL administrators explicitly, from a command prompt started as administrator run:Replace with your actual NT domain name (a non AD domain joined machine is its own NT domain) and your actual user name, of course.