C#异常时,SQL Server 2005实例远程连接 [英] C# Exception when remotely connection to SQL Server 2005 instance

查看:156
本文介绍了C#异常时,SQL Server 2005实例远程连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图连接到SQL Server 2005实例远程但得到以下异常:

Trying to connect to a SQL Server 2005 instance remotely but getting the following exception:

建立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)

已经确认并在服务器能够接受远程连接。我使用的.NET连接字符串看起来是这样的:

Have checked and the server is enabled to accept remote connections. Connection string I'm using in .NET looks like this:

Data Source=SERVERIP\INSTANCE;Initial Catalog=DATABASENAME;User Id=USERNAME;Password=PASSWORD;

任何想法?谢谢:)

Any ideas? Thank you :)

推荐答案

您可能想尝试一个快速的远程登录到服务器的TCP端口1433,看看是否可以建立连接的方式。

You might want to try a quick telnet to TCP port 1433 of the server to see if you can establish a connection that way.

telnet remote_name_or_ip 1433

如果你不能,你知道,这是在网络层,你就可以开始检查之类的东西了Windows防火墙或者其他网络部分,可能在您的方式获得。 (您还需要通过UDP访问端口1434。)

If you can't, you know that it's at the network layer, and you can start checking things like the Windows Firewall or other network pieces that might get in your way. (You also need access via UDP to port 1434.)

这篇关于C#异常时,SQL Server 2005实例远程连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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