IIS 7 – Multiple IIS Sites pointed at same directory. How is this accomplished

iisiis-7web-hostingwindows-server-2008

I need to point two IIS sites at the same folder on the server.

I need to do this because I need different IP-restrictions for the domain name bound to IIS-Site-B vs. IIS-Site-A (which is completely open to the public).

When I add the second site pointed to the same folder, there seems to be some sort of conflict. When I visit the site, there's a runtime error (but error messages beyond that are turned off)

How is this usually accomplished?

This question/answer suggests that it is the proper method for restricting bindings as I need to: iis 7 – IP-restrictions on one part of a website's bindings?

Best Answer

From my experience you won't be able to do this directly with IIS7 since the majority of the configuration settings are stored within a file inside the directory.

For example, I had a fake folder C:\Webs\NoWebSite that I had configured multiple sites to use as they were going to be purely for redirection.

After setting up the first site's redirections, I started working on the second and noticed all my redirection settings from the first site were on the second.

Anything I changed on the second applied back to the first again.

So I had to make individual folders for them to sit on even though there was no content.

A thought would be to try and do it by having the actual content hosted under one domain and then setup the others to use Rewrites to the actual content if it passes the restrictions.

See these about the URL Rewrite extension
http://www.iis.net/download/URLRewrite
http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/

Rewriting happens behind the scenes, the user doesn't know there were any changes to the address, just the server pulls the content from the rewritten location. This is different from a redirection where the server tells the browser to go get the information from a different location. Using rewrites, you can keep your domain1.com and domain2.com visible to the user but actually be serving the information off of domain3.com for example.