localhost工作eventHough在主机中的映射被评论

时间:2013-05-23 03:09:42

标签: c# asp.net windows iis

当hosts文件中的映射到127.0.0.1被注释掉时,为什么localhost在Windows 7 Pro上适用于我?例如,当我在Visual Studio中发布网站时,我可以在导航到该网站时使用localhost。

主机

# 127.0.0.1   localhost

2 个答案:

答案 0 :(得分:0)

有效的Windows 7,DNS现在自动处理localhost的解析,而不是主机文件。

修改:如果您需要,https://superuser.com/questions/453359/do-did-all-versions-of-windows-ship-with-a-host-file-and-do-they-all-have-a-lo/453360#453360

,这是一个来源

答案 1 :(得分:0)

答案在主机文件中(可能不是你的)。从我的Windows 7主机文件:

# localhost name resolution is handled within DNS itself.
#    127.0.0.1       localhost
#    ::1             localhost