我一直在使用一个名为'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