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

asp.net-mvc c# entity-framework sql-server

Question

I worked with c#(started to work). At first I created model. And by this model I created MVC 5 controller with views, using Entity Framework. I thought that all correct (that necessary table will be created by this model, and I can worked with local database), but when I would like to run my application and go to this page http://localhost:49640/ControllerName I get this error:

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.)

I tried to find some solution, but I didn't. As I understood it can be some problems with connectionStrings in Web.config or some problems with connection to server, but how solve this problem?

My connection strings:

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

1
1
6/19/2015 9:53:40 PM

Accepted Answer

I download SqlLocalDb and installed it, this solve my problem. This link connection to local db failed 52 helped me.

2
6/19/2015 10:30:10 PM


Related Questions





Related

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