开发者

IIS: Can I create a host header for an intranet site?

This is a fairly simple question (in my opinion) but for some reason despite my Googling I cannot find a straight answer to it.

Currently I have an application running under my Default Web Site located at http://localhost/myApp. Ideally, I'd like to create a new site in IIS with a binding to 127.0.0.1:80 and a host header of http://myApp so that I can test my url rewriting rules properly (since开发者_Go百科 my app will ultimately be hosted at http://www.myApp.com, not http://www.somedomain.com/myApp).

So, my question is this: will the above work? I haven't had a chance to try it yet.

If the above will not work, what are the steps to be able to access my site at http://myApp on my local network?


It should work provided you fool the OS into resolving www.myapp.com to 127.0.0.1. To do so, edit your hosts file in %systemroot%\system32\drivers\etc to contain the following:

127.0.0.1 myapp.com

I believe you could do just myapp(without the .com) as well, but that gets a bit trickier because how that is resolved depends on your node type. (hybrid, etc) To be safe, add

127.0.0.1 myapp

to BOTH the hosts and LMHosts files in the same directory. By default the lmhosts is non-existent and there is a lmhosts.sam there. You'll have to rename that to just lmhosts or create a new one.

Then create the binding as per usual in IIS7/7.5 (I assume it's 7... Site->Actions->Bindings->Add or Edit->Populate hostname accordingly).. IIS6 will work too but it's alot harder to get https working should you need it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜