到 SQL Server Express 的远程连接失败 [英] Remote connection to SQL Server Express fails

查看:27
本文介绍了到 SQL Server Express 的远程连接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两台共享相同 Internet IP 地址的计算机.使用其中一台计算机,我可以远程连接到另一台计算机上的 SQL Server 数据库.这是我的连接字符串:

I have two computers that share the same Internet IP address. Using one of the computers, I can remotely connect to a SQL Server database on the other. Here is my connection string:

SqlConnection connection = new SqlConnection(@"Data Source=192.168.1.101\SQLEXPRESSNI,1433;Network Library=DBMSSOCN;Initial Catalog=FirstDB;Persist Security Info=True;User ID=username;Password=password;");

192.168.1.101 是服务器,SQLEXPRESSNI 是 SQL Server 实例名称,FirstDB 是数据库名称.

192.168.1.101 is the server, SQLEXPRESSNI is the SQL Server instance name, and FirstDB is the name of the database.

现在,我有另一台具有不同 Internet IP 地址的计算机.我想使用不属于我的局域网的第三台计算机连接到上面的服务器.我目前无法访问第三台计算机,因此我想(如果可能)再次使用 LAN 中的客户端计算机.

Now, I have another computer with a different Internet IP address. I want to connect to the server above using the third computer that does not belong to my local area network. I dont have access to that third computer at the moment, so I want to use (if possible) the client computer in LAN again.

SqlConnection connection = new SqlConnection(@"Data Source=SharedInternetIP\SQLEXPRESSNI,1433;Network Library=DBMSSOCN;Initial Catalog=FirstDB;Persist Security Info=True;User ID=username;Password=password;");

不起作用

请注意,我是初学者,所以即使我知道我想做什么,我也不太确定自己在做什么.通过将 Internet IP 传递给 SqlConnection 对象而不是本地 IP 地址,如何使用同一网络中的客户端计算机成功连接到服务器计算机?另请注意,我的最终目标是使用外部客户端连接到服务器,但我现在无法访问该计算机.我很感激任何帮助.

Note that I am a beginner, so I am not quite sure what I am doing even though I know what I want to do. By passing the Internet IP to the SqlConnection object rather than the local IP address, how can I successfully connect to the server computer, using the client computer in the same network? Also note that my ultimate goal is to connect to the server with an external client, but I don't have access to that computer right now. I'd appreciate any help.

推荐答案

http://blogs.msdn.com/b/sql_protocols/archive/2006/09/30/sql-server-2005-remote-connectivity-issue-troubleshooting.aspx

这篇关于到 SQL Server Express 的远程连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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