0

There is many answers on the issue I am looking for but most of them are on IIS 7 or earlier and nothing worked for me for some reason, so here it goes.

I am trying to add some dummy host names to test my project locally, what I did is editing the hosts file with the fake domain names like below

127.0.0.1        44336     Whatever.com
127.0.0.1        44336     SSOWhatever.Whatever.com

Then I have changed my IIS bindings to for each project to the correct one with the correct port, but this fail to work. what is confusing me even more is that when I remove .com (all the dots have to be removed) so if my file look like below:

127.0.0.1        44336     Whatever
127.0.0.1        44336     SSOWhatever

This works fine but, it is not simulating what I want. any ideas why this is happening is there something I need to set in the IIS.

dori naji
  • 980
  • 1
  • 16
  • 41
  • Please elaborate on "fail to work". What happens when you set the binding's host name to `SSOWhatever.Whatever.com`? – CodeCaster Jan 15 '15 at 11:03
  • on chrome get this error `This web page is not available` and on IE `This page can’t be displayed` – dori naji Jan 15 '15 at 11:04
  • 1
    Since when does windows host file support ports? – TGlatzer Jan 15 '15 at 11:04
  • I am assuming since IIS6 because I think I got the idea of ports from here https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/883a9544-3f70-4d46-a6df-bbadbd1fe7de.mspx?mfr=true I also saw loads of question and answers here with the same hosts file – dori naji Jan 15 '15 at 11:13
  • Well - it's just wrong or is not true anymore: http://stackoverflow.com/questions/8652948/using-port-number-in-windows-host-file – TGlatzer Jan 15 '15 at 11:17
  • I am really not sure I can say this is true because it sure working for me to some extent. actually if I removed the port is failing because I am assuming it is listening to 80 and nothing is there. – dori naji Jan 15 '15 at 11:25
  • What prevents you of typing whatever.com:44336 in your browser? You don't need this in the hosts file (and as I said - it's not supported) – TGlatzer Jan 15 '15 at 11:30
  • ahh now I see what you mean yea you are right, but that doesn't answer my main question or solve my problem. :-( – dori naji Jan 15 '15 at 11:32

1 Answers1

0

Probably you have some mismatches here:

  • The host file is in c:\windows\system32\drivers\etc\
  • The host file does not have any intelligence and supports Host to IP Mappings only
  • The mappings have to be exact: someHost.com will not match www.someHost.com
  • The mappings have the form IPAdress Hostname - there is no support for ports

  • Check that your IIS bindings match to the exact same strings and are bound to all IP addresses or the localhost IP address

If everything is correct you can access your application by typing http(s)://hostname:port

You can also use fiddler for that - the program is also able to do port redirections - and on the plus side you can see the requests for debugging.

TGlatzer
  • 5,815
  • 2
  • 25
  • 46
  • 1
    I gave this the correct answer not because I have a mismatch but your tip on using fiddler, helped me to know the issue is my company proxy interfering. so anyone who land on this page and you are just not understanding why it is not working just check your proxy rules to eliminate one of the reasons, or in my case the main reason. Thanks!! – dori naji Jan 16 '15 at 16:33