指定的LocalDB实例不存在 [英] The specified LocalDb instance does not exist

查看:3625
本文介绍了指定的LocalDB实例不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了一个名为'项目',而现在的LocalDB。这是在默认情况下ASP.NET MVC 5项目创建的同一个数据库。然而,突然停了,我不能够连接到它,也不使用重新启动

  SqlLocalDb项目启动

我得到

 指定的LocalDB实例不存在。

我看到在文件夹

  C:\\用户\\ [我名] \\ AppData \\本地\\微软\\ Microsoft SQL Server的本地DB \\实例\\项目

另外,我在V11.0

  C:\\用户\\ [我名] \\ AppData \\本地\\微软\\ Microsoft SQL Server的本地DB \\实例\\ V11.0

我能够连接到V11。

还有什么我可以尝试重新连接到它?

连接字符串

 <添加名称=DefaultConnection的connectionString =数据源=(的LocalDB)\\项目;初始目录=主;集成安全性= TRUE;连接超时= 30;加密=假; TrustServerCertificate =假的providerName =System.Data.SqlClient的/>

修改

我试过数据库文件附加到连接字符串

  AttachDbFileName = C:\\用户\\ [我名] \\ AppData \\本地\\微软\\ Microsoft SQL Server的本地DB \\实例\\项目\\ master.mdf;

不过,我仍然无法连接

 建立SQL连接时出现与网络相关的或特定于实例的错误
服务器。服务器未找到或无法访问。验证实例名称是否正确
而SQL Server配置为允许远程连接。 (provider:SQL网络
接口,错误:50 - 发生本地数据库运行时错误。指定的LocalDB实例
不存在。)


解决方案

好像(的LocalDB)\\项目实例删除了。您可以使用(的LocalDB)\\ V11.0 或重新创建项目使用的SqlLocalDB实用

  sqllocaldbÇ项目11.0

命令行解释


  • C - 是创造

  • 项目 - 是实例名称

  • 11.0是版本

I've been using a localDB named 'Projects' for a while now. This is the same database that is created by default ASP.NET MVC 5 project. However, suddenly it stopped and I'm not able to connect to it nor restart it using

SqlLocalDb start Projects

I get

The specified LocalDB instance does not exist.

I see the folder in

C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\Projects

also, I have v11.0 in

C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0

I'm able to connect to v11.

What else can I try to reconnect to it?

The connection string is

 <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" />

Edit

I tried Attaching the Db file to the connection string

AttachDbFileName=C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\Projects\master.mdf;

However, I'm still not able to connect

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.)

解决方案

Seems like (localdb)\Projects instance got deleted. You can either use (localdb)\v11.0 or recreate Projects instance using SqlLocalDB utility

sqllocaldb c Projects 11.0

Command line explained

  • c - is for "create"
  • "Projects - is the instance name
  • 11.0 is the version

这篇关于指定的LocalDB实例不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆