0

I have configured my website from VS2010 to use IIS 7.5. Then I added this line to my hosts file:

127.0.0.1 something.com

This correctly goes to IIS 7.5 default screen

However I want this to go to my website that is hosted in IIS 7.5. So I changed the above line to:

127.0.0.1/MyWebSiteHostedinIIS something.com

But when I did this it stopped working. Any ideas what am I doing wrong and how can I correct this?

  • read at least once hosts file format description, inside host file!!! – Lazy Badger Oct 10 '11 at 06:28
  • I read that. "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.". But I basically wanted how to solve this problem. – Bob Lee Swagger Oct 10 '11 at 06:30

1 Answers1

1

YOu know, windows does not care what you want until you actually do it according to specs.

Since more than 20 years - ever since the hsots file was invented for unix - there is a spec what it does and a way how it works.

Putting folders into it WONT WORK.

Hosts does DNS resolution. DNS does not know about folders, even if that would be convenient for you. Host maps host names to IP addresses.

127.0.0.1/MyWebSiteHostedinIIS

is not an IP address.

Ergo it doesn ot work.

What you want can not be done. Point. Use the IIS 7 hosts header feature to do it.

I.e.:

127.0.0.1 something.com

in the hosts file

and in the IIS configuration tell it that something.com maps to a specific location.

TomTom
  • 51,649
  • 7
  • 54
  • 136
  • Ok thanks TomTom.Can you tell where do I configure something.com maps to a specific location? Any links? – Bob Lee Swagger Oct 10 '11 at 06:31
  • Google? **Here is ServerFault**, not Google – Lazy Badger Oct 10 '11 at 06:52
  • @Lazy: If you don't know or don't want to answer why bother commenting on somebody else's post? Why not let others help? What do you want me to type in Google? "IIS configuration"? Do you think that will yield me correct results to what TomTom is talking about? – Bob Lee Swagger Oct 10 '11 at 06:55
  • Site mappings. In the site mappings you can say for every site what host header it reacts to - and in the site setup where to look for it's files. – TomTom Oct 10 '11 at 06:59