0

So I can actually connect to the server as it is localhosted. But when I created a class called Merchant and add the /Merchants to my local host address I get the above error, even though the server does just fine with all the other pages from the web site.

This is my first time messing with C# and Visual Studios, and I am following a tutorial but I got stuck here.

Using MS Visuals 2013, MCV 5.

Here is the Merchants function:

    // GET: Merchants
    public ActionResult Index()
    {
        return View(db.Merchants.ToList());
    }

Here is the connection string:

    <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=         (LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20150610102919.mdf;Initial Catalog=aspnet-WebApplication1-20150610102919;Integrated Security=True"
  providerName="System.Data.SqlClient" />

Here is the full error message:

An exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll but was not handled in user code

Additional information: 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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)

sqluser
  • 5,502
  • 7
  • 36
  • 50
JP Hochbaum
  • 637
  • 4
  • 15
  • 28
  • Is the database service running and are you able to connect via the sql management studio? – codingpirate Jun 11 '15 at 13:30
  • Have you tried this: http://stackoverflow.com/questions/10540438/what-is-the-connection-string-for-localdb-for-version-11 – Luty Jun 11 '15 at 14:00
  • It appears I many not even have SQL on my laptop, strange. Gonna try to get it on there first then get back to this. – JP Hochbaum Jun 11 '15 at 14:02
  • If you have Visual Studio 2012 (11.0) or later installed, so you already have SQL Server localdb. Inside VS, go to VIEW->SQL Server Object Explorer and you will be able to check which SQL Local DB versions you have installed in your environment. – Luty Jun 11 '15 at 14:53
  • Once I get to the Server Object Explorer I can't find out where to find the version I am using. – JP Hochbaum Jun 11 '15 at 15:08

0 Answers0