我一直在使用一個名爲'Projects'的localDB。這是默認ASP.NET MVC 5項目創建的數據庫。然而,突然停了,我無法連接到它也不使用指定的LocalDb實例不存在
SqlLocalDb start Projects
我得到
The specified LocalDB instance does not exist.
我看到
C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\Projects
的文件夾也重新啓動它,我有v11.0在
C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0
我可以t o連接到v11。
我還可以嘗試重新連接它嗎?
連接字符串
<add name="DefaultConnection" connectionString="Data Source=(localdb)\Projects;Initial Catalog=master;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False" providerName="System.Data.SqlClient" />
編輯
我試過數據庫文件附加到連接字符串
AttachDbFileName=C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\Projects\master.mdf;
但是,我仍然無法連接
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. The specified LocalDB instance
does not exist.)
您可以參考以下鏈接: [**創建一個連接字符串和使用SQL Server LocalDB **](http://www.asp.net/mvc/tutorials/mvc-5/introduction/creating-a-connection-string) – RajeshKdev 2014-09-24 04:03:08