指定的LocalDB实例不存在

编程入门 行业动态 更新时间:2024-10-19 02:17:58
本文介绍了指定的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实例不存在

本文发布于:2023-11-15 22:35:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1598557.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不存在   实例   LocalDB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!