如何防止与SQL Server建立连接。服务器未找到或无法访问。 [英] How to prevent from establishing a connection to SQL server. The server was not found or was not accessible.

查看:96
本文介绍了如何防止与SQL Server建立连接。服务器未找到或无法访问。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个项目,第一个是Financial.Asst.core,第二个是Financial.Asst.Data,第三个是Financial.Asst.Web。



在第一个项目中App.config没有任何连接字符串。在第二个项目中,App.config具有以下连接字符串。



I have three projects 1st is Financial.Asst.core, 2nd is Financial.Asst.Data and 3rd is Financial.Asst.Web.

in first project's App.config not have any connection string. in second projects App.config has below connection string.

<div class="op">Quote:</div><connectionStrings>
    <clear />
    <add name="DefaultConnection" connectionString="Data Source=DESKTOP-J97B0AI;Initial Catalog=dada;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>





和第三个项目的web.config文件在连接字符串下面。





and third project's web.config file has below connection string.

<connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=.\sqlexpress;Integrated Security=true;Initial Catalog=DESKTOP-J97B0AI;" providerName="System.Data.SqlClient" />
  </connectionStrings>





所以,我一直试图运行解决方案,然后总是出现以下错误。 />




So, I am keep trying to run the solution then always getting following error.

Quote:

建立连接时发生网络相关或特定于实例的错误到SQL Server。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供者:SQL网络接口,错误:26 - 错误查找指定的服务器/实例)

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: 26 - Error Locating Server/Instance Specified)





所以请各位帮助我防止此问题。



我尝试了什么:



其中我启用了sqlserver和tcpIp服务。



so guys please help me to prevent from this issue.

What I have tried:

where i Enabled the sqlserver and tcpIp services.

推荐答案

我们无法帮助您:您的连接字符串有问题。可能是SQL实例错误,可能是它未配置为远程连接,可能是它不接受Windows标识(通过集成安全性)但需要正确的SQL用户名和密码组合(最好的解决方案,因为用户可以将他的访问限制在他需要完成工作的范围内而不是更多)。可能是该服务器上不存在该数据库。我们无法分辨。



看看这里:简单的SQL连接字符串创建 [ ^ ] - 它可以帮助您创建一个可以使用的条纹。
We can't help you: your connection string is at fault. It may be that the SQL Instance is wrong, it may be it isn't configured for remote connections, it may be that it just doesn't accept Windows Identification (via Integrated security) but needs a "proper" SQL username and password combination (the best solution, as the user can have his access restricted to just what he needs to do the job and no more). It could be the database doesn't exist on that server. We can't tell.

Have a look here: Simple SQL Connection String Creation[^] - it may help you create a strign that you can use.


这篇关于如何防止与SQL Server建立连接。服务器未找到或无法访问。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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