今天遇到一个问题:SQLServer的.如图:
问题报错内容:
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.无法创建自动实例。有关错误详
细信息,请参阅Windows应用程序事件日志。)
原因:在VS上勾选了SQLServer服务,又再次安装了导致版本冲突,添加基于服务的数据库时一直无法自动创建初始化实例.估计是实例被破坏了.
我的解决思路:使用
-- 停止VS中数据库服务
C:>sqllocaldb stop MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" stopped.
-- 删除VS中数据库服务
C:\Users\执着>sqllocaldb delete MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" deleted.
--重新创建VS中数据库服务
C:>sqllocaldb create MSSQLLocalDB