无法使用localhost / 127.0.0.1

时间:2016-08-28 06:25:41

标签: iis iis-7 localhost

我终于[苦心]使用IIS7设置了本地托管的网站。

我现在可以通过主机上的http://localhost/mediaorganizer/http://127.0.0.1/mediaorganizer/连接到它。

但是,当我尝试在自身或网络上的其他计算机上使用主机的IP地址时,出现以下错误:

  

拒绝连接错误

我上下搜索没有运气。我已经为入站设置了防火墙规则,它们使用万维网服务(HTTP Traffic-In)在端口80上设置为TCP。我在IIS中设置绑定为http,All Unassigned,80。我还确保以管理员身份运行IIS管理器时启动该站点。但一切都没有运气。

我觉得我可能错过了达到预期效果的最终过程。我在这个项目上度过了一个坚实的一天,并希望得到任何帮助。

最近日志

  

软件:Microsoft HTTP API 2.0

     

版本:1.0

     

日期:2016-08-28 02:33:55

     

字段:日期时间c-ip c-port s-ip s-port cs-version cs-method cs-uri streamid sc-status s-siteid s-reason s-queuename

     

2016-08-28 02:33:55 127.0.0.1 50211 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 02:36:29 127.0.0.1 50356 127.0.0.1 64900 HTTP / 1.1 GET / - 400 - 主机名 -   2016-08-28 02:37:30 127.0.0.1 50331 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 03:02:37 127.0.0.1 50593 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 03:06:33 127.0.0.1 50607 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 03:10:03 127.0.0.1 50678 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 05:16:54 127.0.0.1 50821 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 05:19:14 127.0.0.1 50864 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 05:32:17 127.0.0.1 50948 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 05:34:32 127.0.0.1 50999 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 05:42:10 127.0.0.1 51036 127.0.0.1 80 HTTP / 1.1 GET /mediaorganizer/about.aspx - 404 - NotFound -   2016-08-28 05:44:30 127.0.0.1 51041 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 05:46:35 127.0.0.1 51059 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -

     

软件:Microsoft HTTP API 2.0

     

版本:1.0

     

日期:2016-08-28 06:00:59

     

字段:日期时间c-ip c-port s-ip s-port cs-version cs-method cs-uri streamid sc-status s-siteid s-reason s-queuename

     

2016-08-28 06:00:59 127.0.0.1 50005 127.0.0.1 80 HTTP / 1.1 GET / MediaOrganizer / - 404 - NotFound -   2016-08-28 06:09:42 127.0.0.1 50188 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 06:09:47 127.0.0.1 50183 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 06:12:58 127.0.0.1 50205 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 06:12:58 127.0.0.1 50208 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 06:16:14 127.0.0.1 50277 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 06:16:14 127.0.0.1 50279 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 17:59:24 127.0.0.1 51430 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -   2016-08-28 17:59:24 127.0.0.1 51428 127.0.0.1 80 - - - - - - Timer_ConnectionIdle -

2 个答案:

答案 0 :(得分:1)

我能纠正这个问题。原来我已经配置IIS通过命令提示符监听IP地址127.0.0.1。我必须通过打开命令提示符撤消此操作并输入以下命令。

netsh
http
show iplisten <- just to confirm it was there, and it was.
delete iplisten ipaddress=127.0.0.1

现在我可以使用PC名称和它的实际IP地址来访问我的本地IIS站点。

答案 1 :(得分:0)

我确实看到了404 - NotFound两次

  

2016-08-28 05:42:10 127.0.0.1 51036 127.0.0.1 80 HTTP / 1.1 GET   /mediaorganizer/about.aspx - 404 - NotFound -

     

2016-08-28 06:00:59 127.0.0.1 50005 127.0.0.1 80 HTTP / 1.1 GET   / MediaOrganizer / - 404 - NotFound -

当您将绑定映射到IIS中的特定主机名时会发生这种情况。像下面的东西。因此,如果您有任何内容,请检查并删除主机名。

如果它为空可能会删除绑定并重新创建而没有任何主机名。

另一个要检查的地方是主机文件(C:\ Windows \ System32 \ drivers \ etc \ hosts)。如果您通过在

之前添加#来查看下面的内容,请注释掉
127.0.0.1       localhost //These should be commented out
::1             localhost //These should be commented out

enter image description here