关于Windows7的localhost

在Windows7的hosts文件里,不再有把localhost指向127.0.0.1的定义了,而是给出了这样一个说明:

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

把localhost的解析也交给DNS了,不知道是出于什么考虑。造成的结果是,在本地开发时,IIS里运行的PHP用localhost连接不到数据库了,让我折腾了很久。在本地开发.net时,调试时用IE比FF,Chrome要快很多,我还以为微软搞了什么后门,原来是因为IE里缓存了DNS的查询结果,而FF和Chrome没有,所以总看到FF下面的状态栏显示“正在解析localhost”,在hosts里加上localhost的设置之后,FF和Chrome也和IE一样了。

This entry was posted in 计算机技术. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>