简体   繁体   English

基础提供程序在打开时失败

[英]The underlying provider failed on open

I know this question has been asked a few times already, but I tried all the solutions I found on stackoverflow and everywhere else and nothing worked, so I'm asking again I'm sorry 我知道这个问题已经被问过几次了,但是我尝试了我在stackoverflow以及其他所有地方找到的所有解决方案,但是没有任何效果,所以我再次问对不起

I used to connect to a remote database on a server, but to test some things I had to backup this database and restore it locally. 我曾经连接到服务器上的远程数据库,但是为了测试某些事情,我不得不备份该数据库并将其还原到本地。 The thing is, when I try to replace the server name by ".\\SQLEXPRESS" in the connection strings, everytime I try to use the database (juste display datas as exemple), I got the error you can see in the title. 问题是,当我尝试用连接字符串中的“。\\ SQLEXPRESS”替换服务器名称时,每次尝试使用数据库时(仅将数据显示为示例),都会出现错误,您可以在标题中看到。

I already tried to Allow remote connections in my local DTC, I tried to open the connection, tried the sp_users command, nothing worked 我已经尝试过允许本地DTC中的远程连接,我试图打开连接,尝试了sp_users命令,但没有任何效果

Here is my connection string : 这是我的连接字符串:

    <add name="HDPreDiagEntities" connectionString="metadata=res://*/HDPreDiag.csdl|res://*/HDPreDiag.ssdl|res://*/HDPreDiag.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;initial catalog=HDPreDiag;persist security info=True;user id=id;password=password;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Thanks guys for your time and help 谢谢你们的时间和帮助

Okay so I tried to create a .UDL file, and when I tried to connect with SQL id, it didn't work. 好的,所以我尝试创建一个.UDL文件,当我尝试使用SQL id连接时,该文件无法正常工作。 I just tried to connect with Windows NT security, opened the .UDL with notepad and copied the connection string in my App.config and it works fine now. 我只是尝试连接Windows NT安全性,使用记事本打开.UDL,然后将连接字符串复制到App.config中,现在可以正常使用了。

If anyone know why I couldn't connect with my DB ids, I'd be glad to hear (knowing that they exist...) 如果有人知道为什么我无法连接我的数据库ID,我很高兴听到(知道它们存在...)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM