无法连接到本地主机,但可以在 SQL Server 2008 中使用计算机名称 [英] Can't connect to localhost, but can with computer name in SQL Server 2008

查看:24
本文介绍了无法连接到本地主机,但可以在 SQL Server 2008 中使用计算机名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 SQL Server 2008 并且在 Visual Studio 中的服务器资源管理器中,我可以使用我的计算机名称连接到运行的 SQL Server,但是我不能使用 127.0.0.1 或 localhost,它们不应该是相同的?

I'm using SQL Server 2008 and in Visual Studio, in Server Explorer, I can connect to SQL Server running using my computer name, but I can't using 127.0.0.1 or localhost, shouldn't they be the same?

此外,在网站的 web.config 文件中使用连接字符串时,我无法使用 localhost 进行连接,而只能使用计算机名称进行连接!我在 SQL 配置管理器中的某处缺少某些设置吗?

Also when using a connection string in the web.config file for the website I can't connect using localhost, but only with the computer name! Is there some setting I'm missing somewhere in the SQL Config Manager?

推荐答案

如果有人关注了这篇文章但仍然没有解决他们的问题(像我一样),以下是为我解决的问题:

If someone followed this post and still hasn't solved their problems (like me), here's what solved it for me:

步骤 1:我转到 SQL Server 网络配置中的 TCP/IP 行,在 SQLEXPRESS 的协议下(尽管您应该选择活动的 sql 服务器)并单击属性:

Step 1: I went to the TCP/IP line in SQL Server Network Configuration, under Protocols for SQLEXPRESS (though you should select your active sql server) and clicked on properties:

第 2 步:然后,我确保在 IP 地址下,组 IP4 已启用 =是",并且其中的 TCP 端口设置为 1433(默认 sql server 端口),就像这里:

Step 2: Then, I made sure that under IP Addresses, the group IP4 is Enabled = "Yes", and that the TCP Port in there is set to 1433 (the default sql server port), like here:

第 3 步:最后,作为预防措施,我也将所有其他 IP 组端口更改为 1433,并启用 =是"它们从 IP2 到 IP5(我看到了这个在另一台计算机上).我还将 IPAll(最后一组)的 TCP 端口也更改为 1433.但这只是我.我疯了.疯了.这是对你有好处.最后,确保在协议选项卡上也将启用设置为是.

Step 3: Lastly, just as a precaution, I've changed all the other IP group ports to 1433 also, and enabled = "Yes" them from IP2 to IP5 (I saw this one at another computer). I've also changed the IPAll's (the last group) TCP Port to 1433 as well. But that's just me. I'm crazy. Go crazy. It's good for you. Last, make sure Enabled is set to Yes on the protocol tab as well.

然后 - 万岁!有效.为所有花时间解决别人问题的好心人干杯.

这篇关于无法连接到本地主机,但可以在 SQL Server 2008 中使用计算机名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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