找不到Localhost(404)iis

时间:2014-01-20 18:43:50

标签: asp.net iis visual-studio-2012 localhost

我在计算机上遇到DNS localhost的几个问题。

当我在visual studio或任何浏览器中查找localhost时,某些指令会重定向我的所有探索器,包括除127.0.0.1之外的其他地方的visual studio。

这样的事情会发生在哪里?我最近将我的hosts文件更改为指向localhost的其他位置,但之后它没有工作,所以我将其切换回来,因此无法解决问题。

# Copyright (c) 1993-2009 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

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

我还没有安装和安装IIS,所以不是iis没有正确重定向的问题..

由于此问题,我无法运行Visual Studio解决方案。

我已经尝试了127.0.0.1并且它响应,我也尝试过localhost它也可以工作,但是当我在浏览器上键入localhost时它会重定向到“404”页面。

3 个答案:

答案 0 :(得分:2)

确保IIS实际配置为侦听127.0.0.1(可能您之前删除了绑定?)

netsh http show iplisten
IP addresses present in the IP listen list: 127.0.0.1

您可以添加其他类似的IP:

netsh http add iplisten ipaddress=10.0.0.10

答案 1 :(得分:1)

我也遇到了这个问题,事实证明这是IIS中默认网站绑定的问题。我已将“主机名”指定为服务器的域名,这意味着外部访问可以正常工作,但是尝试通过localhost访问任何IIS页面均返回了浏览器404错误。

只需清除“主机名”字段并将其保留为空即可解决此问题。

答案 2 :(得分:0)

我向该站点添加了绑定,该站点通过端口80接受了IP地址127.0.0.1,并且能够连接。