Vista SP1、VS2008 SP1环境中 localhost无法访问
描述如下:
A、联网情况下
在VS中按F5运行Web调试,出错提示为:“
Internet Explorer 无法显示该页面
”此时IE8的地址栏中为“http://localhost:6999/Web/”将localhost改为“127.0.0.1”竟然可以!⊙﹏⊙b汗!
B、断开网线,直接调试运行。无任何问题,(#‵′)靠!;此时IE8标题栏还是”http://localhost:6999/Web/“
在没升级为IE8之前,我是IE7也出现过类似的问题,但是没注意,不知道这个Vista的问题呢,还是VS2008的问题,希望知道的同志能分析下,或者给个修复的办法!
==========================================================================
问题解决了,竟然真的是host的问题
解决问题的思路:
不管如何现在host的可疑最大
在cmd中输入 C:\WINDOWS\system32\drivers\etc\hosts
发现host文件如下显示
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
::1 localhost
⊙﹏⊙b汗啊!
没有 127.0.0.1 啊。~
于是在做了如下修改
127.0.0.1 localhost
::1 localhost
再次运行VS调试,问题解决!
思考,在断开网络的情况下为什么能正确映射呢?
注明【原创】内容为本人创作之内容,禁止任何形式的转载。