在 %systemroot%\system32\drivers\etc\hosts 文件中包含端口号

发布于 2024-08-11 05:56:52 字数 156 浏览 2 评论 0原文

是否可以在主机文件中包含端口号?我问这个问题的原因是因为我尝试将一些站点从一台托管服务器迁移到另一台托管服务器,并且这些站点指向使用标准 TCP/IP 端口 (1433) 的旧 SQL 服务器。在新服务器上,SQL Server 端口不同,我不想更改这些站点的连接字符串。

谢谢你!

Is it possible to include port numbers in hosts file? Reason that I'm asking is because I have sites that I'm trying to migrate from one hosting server to another, and the sites are pointing to an old SQL server that uses the standard TCP/IP port (1433). On the new server, the SQL Server port is different, and I don't want to change the connection strings for these sites.

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

如日中天 2024-08-18 05:56:52

这在主机文件中是不可能的。 DNS 不知道有关端口号的任何信息。

This is not possible in the host file. DNS doesn't know anything about port numbers.

我不会写诗 2024-08-18 05:56:52

您可以在 SQL 配置管理工具中配置别名。旨在准确地涵盖这种情况。

You can configure an alias in the SQL Configuration Management tool. Is designed to cover exactly this scenario.

梦萦几度 2024-08-18 05:56:52

主机文件将主机名转换为 IP 地址(反之亦然)。您不能包含端口号。

The hosts file translates host names to IP addresses (and vice-versa). You can't include port numbers.

追我者格杀勿论 2024-08-18 05:56:52

您可以设置路由器在新站点进行端口转发,并且如果尚未通过路由器进行路由,则将路由器的地址作为新主机。

You could set up a router to do port forwarding at the new site, and—if not already routed through the router, then give the router's address as the new host.

谎言 2024-08-18 05:56:52

如果这对任何人有帮助,我在主机文件中定义如下:

xxx.xxx.xxx.xxx  MyServer

MyServer 在特定端口上工作。

当 SQL Server 2005 Management Studio 在创建连接时询问“服务器名称”时,我输入“Myserver,1234”,其中 1234 是端口号。

因为它会在下次下拉菜单中记住它们,所以这对我来说已经足够了。

If this helps anyone I definded mine as follows, in the hosts file:

xxx.xxx.xxx.xxx  MyServer

The MyServer works on a specific port.

The when SQL Server 2005 management studio asks for 'server name' when creating a connection, I entered 'Myserver,1234' where 1234 was the port number.

Since it remembers them in a drop down for next time, this was good enough for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文