无法连接到本地主机,但可以在 SQL Server 2008 中使用计算机名称

编程入门 行业动态 更新时间:2024-10-08 00:29:10
本文介绍了无法连接到本地主机,但可以在 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 中使用计算机名称

本文发布于:2023-10-16 14:04:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1497782.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   名称   主机   计算机   Server

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!