0

关于我正在寻找的问题有很多答案,但其中大多数都在 IIS 7 或更早版本上,并且由于某种原因对我没有任何作用,所以就在这里。

我正在尝试添加一些虚拟主机名来在本地测试我的项目,我所做的是使用如下所示的假域名编辑主机文件

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

然后,我将每个项目的 IIS 绑定更改为具有正确端口的正确绑定,但这无法正常工作。更让我困惑的是,当我删除 .com (必须删除所有点)时,如果我的文件如下所示:

127.0.0.1        44336     Whatever
127.0.0.1        44336     SSOWhatever

这工作正常,但它不是模拟我想要的。为什么会发生这种情况的任何想法是我需要在 IIS 中设置的东西。

4

1 回答 1

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.

于 2015-01-15T11:40:12.303 回答