Iis – In IIS, is it better to host multiple applications as independent web sites or as virtual directories in the default site

iisiis-7windows-server-2008

Background

I have recently developed a MVC application for a client and they would like to host it, along with a few other apps on the same server.

I am more of a developer than a server admin, but my instinct was to set up a new site in IIS with it's own sub-domain binding.

The client, however, would like to instead create a virtual directory in the default site that points to the application. So, for example, you would have:

COMPANY.COM/APP1 and COMPANY.COM/APP2

Rather than:

APP1.COMPANY.COM and APP2.COMPANY.COM

This did work; however, it conflicted with relative URLs in standard HTTP markup, a problem that was quickly resolved.

Question

Is it better to host multiple web apps on the same server as separate sites or as virtual directories within the default website? Are there any pitfalls with the virtual directory approach?

I am not judging the virtual directory approach, it is just new to me and I want to ensure that it won't cause problems now or in the future.

Best Answer

I have always tried to stick to individual sites for applications. You get much more control over everything and if you're running ASP.NET you don't run into web.config cascading issues that are easy to hit. Plus you have finer grained control over application pools and actually being able to watch the performance of each individual application. This is all preference.

Regardless, probably the best answer is that you apply bindings at the website level and NOT the application level. So if each app needs its own URL or SSL as opposed to non-SSL you really do have to look at individual sites.

Plus as you mention you almost have to program with the deployment mechanism in mind. As any use of relative URLs breaks lots of stuff.

Lastly: why don't they want to use sub-domains? It provides nice clean RESTfulish separation of resources if you ask me.