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?

2
  • read at least once hosts file format description, inside host file!!! Oct 10, 2011 at 6: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. Oct 10, 2011 at 6:30

1 Answer 1

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.

4
  • Ok thanks TomTom.Can you tell where do I configure something.com maps to a specific location? Any links? Oct 10, 2011 at 6:31
  • Google? Here is ServerFault, not Google Oct 10, 2011 at 6: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? Oct 10, 2011 at 6: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, 2011 at 6:59

Not the answer you're looking for? Browse other questions tagged .