Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm not very clued up on IIS, but I'm trying to do something that I thought would be quite simple.

All I did was add a binding to the site via IIS. I then undid my change by deleting the binding.

In IE, if I browse to http://localhost:80, I am greeted with a pretty picture with a bunch of welcome messages and a big "IIS7", thanks to the graphic designers at Microsoft.

If I browse to http://mycomputername:80, I'm greeted with 404.

If I browse to anywhere other virtual directory on localhost, I get 404.

Any idea how can I fix it?

share|improve this question

migrated from stackoverflow.com Nov 15 '11 at 15:49

This question came from our site for professional and enthusiast programmers.

closed as off topic by Shane Madden, MDMarra, MikeyB, Tom O'Connor, Chopper3 Nov 15 '11 at 16:57

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
I restored to a restore point to resolve this issue. So unfortunately I don't know what the problem was. And sorry to those who got their answers marked down... it wasn't me :) –  Lost Hobbit Nov 15 '11 at 16:33
    
I'm not sure whether I've misunderstood the question, but I read that you're mostly asking why IE and Chrome are behaving differently? The first thing I'd do is check that one or the other isn't showing you some old state from cache: clear cache from both browsers and then try? –  eggyal Nov 15 '11 at 16:59
    
I realized after posting the initial question that "I could not access any of the virtual sub-directories on localhost via my browser." By this I refer to any browser. So my question now is why could I suddenly not access anything except for (in IE, and nowhere else) localhost:80 –  Lost Hobbit Nov 15 '11 at 17:13

4 Answers 4

HTTP/1.1 compliant web browsers send an HTTP header called "Host" along with every request, to inform the server which name they're requesting resources from - this allows for a server to host multiple separate sites via the same IP address.

Because of this, modern web servers have a baked-in capability to treat requests to different hosts as if they're coming in to a completely different site based on the content of that "Host" header.

In your case, the computer's name is resolving successfully to your local system (exactly what address it resolves to depends on your networking configuration) as is evident from the 404 responses that IIS is generating, but IIS isn't mapping the request to the site that you're expecting it to.

The issue is in your IIS bindings configuration. Your issue is one of three possibilities:

  • The binding on the desired site is not set to the right host name. It may be set to just localhost, while the request is coming in with a header of mycomputername.
  • The binding is not set to the right IP address. It may be set to just 127.0.0.1, while the name resolution process is probably resolving the name to a bound address instead.
  • Even if the desired site's binding matches, another site is getting the request because it has a more applicable binding. For instance, if your desired site is bound to all addresses on a given port, and another site has that same port bound with a more specific address, it will get the request instead.
share|improve this answer

You can do this via hosts file or adding a host header in IIS Manager.

You have IIS looking at a specific IP address only. Go to IIS Manager, then go to properties on the website. Then, from the Web site tab, go to properties.

Add a identity for that host header value.

share|improve this answer

you can edit your c:\windows\system32\drivers\etc\hosts file.. add

127.0.0.1 mycomputername

and try.

share|improve this answer
    
+1 you were the first and no one else is upvoting. It doesn't hurt to upvote people! –  JonH Nov 15 '11 at 13:40
    
I would have ticked it, but unfortunately adding the entry to my hosts file isn't solving my problem. I think I've annoyed IIS by clicking around without knowing what I'm doing. I've tried iisreset... and now I'll try restart my computer. I was messing around in Bindings earlier, but I thought I put everything back as it was. –  Lost Hobbit Nov 15 '11 at 13:49
    
did you restart IE after you added the entry? –  bitsMix Nov 15 '11 at 15:16
    
Yes bitsMix, I did try re-opening IE. Got our web expert to take a look and he couldn't solve it, so I restored to yesterday's restore point and that solved it... still don't know what the problem was though. –  Lost Hobbit Nov 15 '11 at 16:32

you should add your computer name in the hosts file under

C:\Windows\System32\drivers\etc

After that IIS will resolve it properly

# 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       computername
share|improve this answer
    
the file is hosts (no extension) , not Host –  Pete Wilson Nov 15 '11 at 13:53
    
I have just misspell it. Thanks anyway –  Massimiliano Peluso Nov 15 '11 at 15:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.