I have an AWS web server - call it box.company.com. It's running IIS and if I visit http://box.company.com in a web browser (from any machine, including box.company.com), it responds correctly with our site. However, if I visit localhost/ or 127.0.0.1/ when I'm logged into box.company.com, I get a "couldn't connect to host" message.
The hosts file has only one entry - the standard "127.0.0.1 localhost" line. Pinging 127.0.0.1 works fine. Pinging localhost correctly resolves to 127.0.0.1 and works fine.
I've tried restarting IIS and restarting the DNS Cache. I had this problem once before, and restarting the server fixed it, but I'd like to know what's going on in case this happens again in the future.