Adding localhost entry to Windows\System32\drivers\etc\hosts file with port number

2

1

I have set up a local site under IIS 7.5 under port 900. to access it I should type localhost:900 in the address bar.
I'm a little bit familiar with the System32\Drivers\etc\hosts file and I know I can define my custom name with IP adderss there. For example I can add: 127.0.0.1 MyLocalSite and whenever I type in http://MyLocalSite in the browser, The DNS resolves its IP as 127.0.0.1.
Is there anyway that I can specify port number in that file as well? (e.g. 127.0.0.1:900 MySecondSite and the DNS resolves it correctly) I tried 127.0.0.1:900 and 127.0.0.1::900 with no luck.

Kamyar

Posted 2011-01-05T19:25:31.900

Reputation: 291

Answers

8

Kamyar, Sadly, the hosts file only associates a name to an IP address. Adding a port would make the syntax invalid.

Check out Windows HOSTS file

Jeff F.

Posted 2011-01-05T19:25:31.900

Reputation: 4 293

Tanks Jeff. Too bad. – Kamyar – 2011-01-05T20:22:30.737