Tôi đã sử dụng localDB có tên là 'Projects' trong một thời gian. Đây là cơ sở dữ liệu tương tự được tạo bởi dự án ASP.NET MVC 5 mặc định. Tuy nhiên, đột nhiên nó dừng lại và tôi không thể kết nối với nó cũng không khởi động lại nó bằng cách sửVí dụ LocalDb được chỉ định không tồn tại
SqlLocalDb start Projects
tôi nhận được
The specified LocalDB instance does not exist.
tôi thấy các thư mục trong
C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\Projects
cũng, tôi có v11.0 trong
C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0
Tôi không thể o kết nối với v11.
Tôi có thể thử kết nối lại với thiết bị nào khác?
Các chuỗi kết nối là
<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" />
Sửa
tôi đã cố gắng Gắn file Db đến chuỗi kết nối
AttachDbFileName=C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\Projects\master.mdf;
Tuy nhiên, tôi vẫn không thể kết nối
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.)
Bạn có thể tham khảo link này: [** Tạo một chuỗi kết nối và làm việc với SQL Server LocalDB **] (http://www.asp.net/mvc/tutorials/mvc-5/introduction/creating-a-connection-string) – RajeshKdev