IIS 拒绝连接到 localhost 和 127.0.0.1

Mar*_*rco 4 iis-7 localhost windows-server-2008-r2

我无法在我的一台机器上连接到 localhost 和 http://127.0.0.1。但是http://machinename有效。

这会导致 Windows 令牌应用程序无法发出令牌,因为它无法连接。

这显示在事件日志中:

Request for security token failed with exception: 
System.ServiceModel.EndpointNotFoundException: Could not connect to 
http:// localhost : 32843/SecurityTokenServiceApplication/securitytoken.svc/actas. 
TCP error code 10061: No connection could be made because the target machine actively 
refused it 127.0.0.1:32843
Run Code Online (Sandbox Code Playgroud)

我可以 ping 到本地主机:

Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Run Code Online (Sandbox Code Playgroud)

同样对于 127.0.0.1

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Run Code Online (Sandbox Code Playgroud)

hosts 文件未更改,其中没有活动条目。

netstat -ao | findstr LISTENING在 Powershell 中发出命令后,我发现了以下 2 个条目:

TCP 172.16.2.187:32843 机器:0 侦听 4 TCP 172.16.2.187:32844 机器:0 侦听 4

看起来不错,表明服务已启动并正在运行。此外,每个应用程序池都已启动,网站正在运行,并且可以从外部访问(阅读我们的 LAN)。

如果您需要其他信息,请在评论中询问它们,我会将它们添加到这篇文章中。

请帮助我找到错误配置。亲切的问候。

Lan*_*ayx 6

我遇到了同样的问题,但是 localhost 可以工作,因为 ::1 地址正在侦听以及网络 IP。这个命令帮助了我

netsh http add iplisten 127.0.0.1
Run Code Online (Sandbox Code Playgroud)