I am learning ASP.NET MVC, from official site.
When I reach at this tutorial page, after creating Movies controller, when I navigate to url: localhost://xxxx/movies/index I got an exception.
Exception Message is :
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: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details
My system details are:-
- Windows 10 pro (64 bit)
- Visual studio for community 2015
- SQL Server 2014 (64 bit)
Connection string in web.config file is this
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename="|DataDirectory|\aspnet-world movies-20150825083408.mdf";Initial Catalog="aspnet-world movies-20150825083408";Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="MovieDBContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Movies.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
The exception is in this action method at line #20
public ActionResult Index()
Line 19: {
Line 20: return View(db.Movies.ToList());
Line 21: }