Entity Framework Connection to localDb

c# database-connection entity-framework sql-server


I am trying to follow the pluralsight course ASP.NET MVC 4 Fundamentals. But can't have my database connected.

Here is the error I got:

An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.

I have visual studio 2013 professional and SQL server 2012 installed on my machine. When I installed my SQL server, I created a server name "ABC" on my computer.

I have also installed sql localdb 11.0 separately, but it seems VS can't find the localDb connection. When I check Server Explorer -> add Connection, under server name list, only "ABC" is shown up.

Here is the connection string.

I also tried to use "Data Source = ABC; ...." it doesn't work either.


Here is my connection string

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-eManager.Web-20141223223418;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-eManager.Web-2014122322341‌​8.mdf" providerName="System.Data.SqlClient" />
12/25/2014 1:44:46 AM

Popular Answer

Run this command to make sure what is the version of your LocalDB sqllocaldb info sqllocaldb info command result

So in my case the version is MSSQLLocalDB then the connection string will look like this

<add name="DefaultConnection" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;Initial Catalog=IdentityManagerDB;Integrated Security=True" providerName="System.Data.SqlClient" />

11/15/2017 10:44:11 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow