无法连接到 SQL Express“错误:26-错误定位服务器/实例指定)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6466974/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 11:06:38  来源:igfitidea点击:

Unable to connect to SQL Express "Error: 26-Error Locating Server/Instance Specified)

sqlsql-serversql-server-2008r2-express

提问by 0x0000001E

I am at an loose end with one particular box that is running SQL Server 2008 R2 Express.

我对一个运行 SQL Server 2008 R2 Express 的特定机器束手无策。

  • Windows Firewall is configured to allow inbound TCP & UDP 1433, 1434.
  • Windows Firewall is configured to allow outbound TCP & UDP on any port.
  • No other software AV/FW is currently running.
  • Windows 防火墙配置为允许入站 TCP 和 UDP 1433、1434。
  • Windows 防火墙配置为允许任何端口上的出站 TCP 和 UDP。
  • 当前没有其他软件 AV/FW 正在运行。

When I try to connect to xxx.xxx.xxx.xxx\sqlexpress, it times out with the following error:

当我尝试连接到 时xxx.xxx.xxx.xxx\sqlexpress,它超时并出现以下错误:

TITLE: Connect to Server

Cannot connect to xxx.xxx.xxx.xxx\SQLEXPRESS.

ADDITIONAL INFORMATION:

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) (Microsoft SQL Server, Error: -1)

标题:连接到服务器

无法连接到 xxx.xxx.xxx.xxx\SQLEXPRESS。

附加信息:

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

I have checked that remote connections are allowed on the server.

我已经检查过服务器上是否允许远程连接。

I have confirmed TCP/IP is enabled and configured in SQL Server Configuration to allow connections on the external IP to 1433.

我已确认在 SQL Server 配置中启用并配置了 TCP/IP,以允许通过外部 IP 连接到 1433。

I have also used Wireshark from my local machine and I can see requests for 1433 UDP going to the remote server.

我还在本地机器上使用了 Wireshark,我可以看到对 1433 UDP 的请求发送到远程服务器。

But using Wireshark on the remote server shows no inbound connection requests for 1433 UDP or anything from my external IP (with filtering to remote RDP from results).

但是在远程服务器上使用 Wireshark 显示没有对 1433 UDP 或来自我的外部 IP 的任何内容的入站连接请求(从结果过滤到远程 RDP)。

This makes me think it is a firewall issue.

这让我认为这是一个防火墙问题。

The server is hosted by an external company who have control over the PIX in front of our server.

服务器由外部公司托管,该公司可以控制我们服务器前面的 PIX。

I need to troubleshoot this as much as possible myself as the hosting company have no clue what they are doing.

我需要自己尽可能多地解决这个问题,因为托管公司不知道他们在做什么。

回答by Mark Whitfeld

I had a similar problem which was solved by going to the "SQL Server Configuration Manager" and making sure that the "SQL Server Browser" was configured to start automatically and was started.

我有一个类似的问题,通过转到“SQL Server 配置管理器”并确保“SQL Server 浏览器”配置为自动启动并已启动来解决。

I came across this solution in the answer of this forum post: http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/8cdc71eb-6929-4ae8-a5a8-c1f461bd61b4/

我在这个论坛帖子的回答中遇到了这个解决方案:http: //social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/8cdc71eb-6929-4ae8-a5a8-c1f461bd61b4/

I hope this helps somebody out there.

我希望这可以帮助那里的人。

回答by Ashish

press windows+Ropen RUN Window

windows+R打开运行窗口

services.msc 

find SQL Server(SQLEXPRESS) right click on that and start the service then check

找到 SQL Server(SQLEXPRESS) 右键单击​​它并启动服务然后检查

回答by Vishal Shah

Go to SQL Server Configuration Manager > SQL Server Services >In Right Side window show all the servers which may stop. If you are using "SQLEXPRESS"then , Right click on SQL Server(SQLEXPRESS)and start. After try to connect server... I had same problem but I resolved by these steps.

转到SQL Server 配置管理器 > SQL Server 服务 >在右侧窗口中显示所有可能停止的服务器。如果您使用的是“SQLEXPRESS”,右键单击 SQL Server(SQLEXPRESS)并启动。尝试连接服务器后......我遇到了同样的问题,但我通过这些步骤解决了。

回答by Jimbo

Here is a simple method to troubleshoot connection issues:

以下是解决连接问题的简单方法:

  1. Create an empty file called test.udl using a text editor
  2. Double click the file test.udl, then specify your connection properties
  3. Hit the "Test Connection" button.
  1. 使用文本编辑器创建一个名为 test.udl 的空文件
  2. 双击文件 test.udl,然后指定您的连接属性
  3. 点击“测试连接”按钮。

回答by user2347719

I recently encountered the same issue however I am using Windows 10 Technical Preview Build 10041 and SQL Server 2014 (Advanced).

我最近遇到了同样的问题,但是我使用的是 Windows 10 Technical Preview Build 10041 和 SQL Server 2014(高级)。

Follow the same advice from above:

遵循以上相同的建议:

In particular, my problem was that I did not enable the TCP/IP in Sql Server Configuration Manager->SQL Server Network Configuration->Protocols for SQLEXPRESS.

Once you open it, you have to go to the IP Addresses tab and for me, changing IPAll to TCP port 1433 and deleting the TCP Dynamic Ports value worked.

Follow the other steps to make sure 1433 is listening (Use netstat -an to make sure 0.0.0.0:1433 is LISTENING.), and that you can telnet to the port from the client machine.

Finally, I second the suggestion to remove the \SQLEXPRESS from the connection.

特别是,我的问题是我没有在 Sql Server Configuration Manager->SQL Server Network Configuration->Protocols for SQLEXPRESS 中启用 TCP/IP。

打开它后,您必须转到 IP 地址选项卡,对我来说,将 IPAll 更改为 TCP 端口 1433 并删除 TCP 动态端口值。

按照其他步骤确保 1433 正在侦听(使用 netstat -an 确保 0.0.0.0:1433 正在侦听。),并且您可以从客户端计算机 telnet 到端口。

最后,我提出了从连接中删除 \SQLEXPRESS 的建议。

AND ----> That last line is important! It looks like to be Windows 10 specific; remove \SQLEXPRESS from your connection string. What was frusting was that SQL Management Studio connects just fine using either connection string (full or short), however Visual Studio only accepted the connection string without the \SQLEXPRESS.

和---->最后一行很重要!它看起来像是特定于 Windows 10 的;从连接字符串中删除 \SQLEXPRESS。令人沮丧的是,SQL Management Studio 使用任一连接字符串(完整或短)连接都很好,但是 Visual Studio 只接受没有 \SQLEXPRESS 的连接字符串。

回答by Protector one

The active firewall on the server might be causing this. You can try to (temporarily) turn it off and see if it resolves the issue.

服务器上的活动防火墙可能导致这种情况。您可以尝试(暂时)关闭它,看看它是否能解决问题。

If it is indeed caused by the firewall, you should allegedly be able to resolve it by adding an inbound rule for TCP port 1433 set to allowed, but I personally haven't been able to connect this way.

如果确实是防火墙引起的,据称您应该可以通过将 TCP 端口 1433 的入站规则设置为允许来解决它,但我个人无法通过这种方式连接。

回答by user2415870

It's security all about. Make sure you have double check your firewall (windows and anti virus) in some cases when you disabled av firewall and restart your computer, automatically windows firewall is active and it's still block your application. Hope this is helpful ..

一切都是为了安全。在某些情况下,当您禁用 av 防火墙并重新启动计算机时,请确保仔细检查您的防火墙(Windows 和防病毒),Windows 防火墙会自动处于活动状态并且它仍然会阻止您的应用程序。希望这是有帮助的..

回答by Samar Qureshi

I had a Same Problem but i solved by Restarting the browser service in SQL CONFIGURATION MANAGERand removing \SQLEXPRESS from the instance namein the connection window.

我遇到了同样的问题,但我通过在 SQL CONFIGURATION MANAGER 中重新启动浏览器服务连接窗口的实例名称中删除\SQLEXPRESS 来解决

回答by user3869653

I found this url to be very useful: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/2cdcab2e-ea49-4fd5-b2b8-13824ab4619b/help-server-not-listening-on-1433

我发现这个网址非常有用:https: //social.msdn.microsoft.com/Forums/sqlserver/en-US/2cdcab2e-ea49-4fd5-b2b8-13824ab4619b/help-server-not-listening-on-1433

In particular, my problem was that I did not enable the TCP/IP in Sql Server Configuration Manager->SQL Server Network Configuration->Protocols for SQLEXPRESS.

特别是,我的问题是我没有在 Sql Server Configuration Manager->SQL Server Network Configuration->Protocols for SQLEXPRESS 中启用 TCP/IP。

Once you open it, you have to go to the IP Addresses tab and for me, changing IPAll to TCP port 1433 and deleting the TCP Dynamic Ports value worked.

打开它后,您必须转到 IP 地址选项卡,对我来说,将 IPAll 更改为 TCP 端口 1433 并删除 TCP 动态端口值。

Follow the other steps to make sure 1433 is listening (Use netstat -an to make sure 0.0.0.0:1433 is LISTENING.), and that you can telnet to the port from the client machine.

按照其他步骤确保 1433 正在侦听(使用 netstat -an 确保 0.0.0.0:1433 正在侦听。),并且您可以从客户端计算机 telnet 到端口。

Finally, I second the suggestion to remove the \SQLEXPRESS from the connection.

最后,我提出了从连接中删除 \SQLEXPRESS 的建议。

EDIT: I should note I am using SQL Server 2014 Express.

编辑:我应该注意到我使用的是 SQL Server 2014 Express。

回答by user3869653

Have you Disabled the VIA setting in the SQL configuration manager? If not, do disable it first (if VIA is enabled, you cannot get connected) and yes TCP must be enabled. Give it a try and it should be working fine.

您是否在 SQL 配置管理器中禁用了 VIA 设置?如果没有,请先禁用它(如果启用了 VIA,则无法连接)并且是 TCP 必须启用。试一试,它应该可以正常工作。

Make the changes only for that's particular instance name.

仅对该特定实例名称进行更改。

Cheers!

干杯!