Recently in the practice of doing mvc5, the results of the database connection at the stage of the problem, I began to think <add name= "Moviedbcontext" connectionstring= "Data source= (LocalDB) \v11.0; attachdbfilename=| datadirectory|\movies.mdf;integrated security=true "providername=" System.Data.SqlClient "/> This link string is problematic, It's been a mistake all along.
Look at the SQL Server service is turned on, and then go to the configuration Manager to see the TCP/IP protocol is also started, I wondered how the problem came, the service opened I will restart the computer, and then open the VS open the project the prompt came.
It turned out to be my SQL Server LocalDB did not install Ah, the problem found hurriedly take to the website to download the SQL Server LocalDB, who know download down or no use start up or the same problem, I thought the strength did not open I went to the C-drive folder to find the LocalDB.exe file executed or not.
Because the database I installed is 2016, so I was wondering if I could download a SQL Server Express localdb. Here is the English version
Https://download.microsoft.com/download/9/0/7/907AD35F-9F9C-43A5-9789-52470555DB90/ENU/SqlLocalDB.msi
Download the C-drive to start the installation of LocalDB.exe good, the problem solved how to see LocalDB installed successfully did not? My point is VS2017. SQL Server Object Explorer inside the view
Then right click on SQL Server Add SQL Server Click Browse, expand Locally, wy-59420cc is the computer name, not installed before the following 3 I did not, after installing SQL Server 2012 with the LocalDB Express after the appearance.
As to why the SQL Server2012 Express LocalDB has not been resolved, I am still exploring.
Summary: There are problems to solve, and later such a problem can be handled as follows:
1. Open the SQL Server Configuration Manager to see if TCP/IP in the network protocol has an open port number is not right, IP is not correct in looking at SQL Server related services opened no;
2. Install SQL Server 2012 or Express LocalDB download the corresponding version I can not find the 2016 Chinese version of the English version of the download can be used. Need to LACLDB 2012 2016 installation package can leave a message to you.
VS. Web project needs to install SQL Server Express localdb issue