First, do not confuse an IIS Website (or simply a ‘site’) with an application. Within a single site, one can host multiple applications. Each application typically gets its own folder and its own app pool.

Say you have a new IIS install – and are provided with the ‘Default Web Site’. This is typically pointed to a physical directory like c:\inetpub\wwwroot…)

Now, say you want to host two different apps – App1 and App2 on this default web site. You would need to create two different virtual folders (and promote them to apps). Each of these apps would have its own physical directory (e.g. inetpub\wwwroot\App1\ and  inetpub\wwwroot\App2\ ) In addition ,each of these should be given their own app pools – so as to maintain their isolation. 

 

The default website would be pointed to the root folder –   c:\inetpub\wwwroot\.  Say you need to have App1 as the default app that loads when people go to www.yoursite.com. You have two options – 

  1. Change the default website’s physical path to point to c:\netpub\wwwroot\App1\ . This method , though simple, comes with a set of drawbacks. The two apps (app1 and app2) will now need to maintain non-conflicting web.config keys (no keys can be repeated). This can be  a pain to work around in practice.
  2. Do an Http Redirect from the root (c:\inetpub\wwwroot\ ) to c:\netpub\wwwroot\App1\ . This , though not as simple as option 1, provides complete isolation for the two apps.  No web.config conflict issues. This should be the ‘best practice’ way of hosting multiple apps under a single IIS website.

Thoughts ? Comments ? 

 

Anuj holds professional certifications in Google Cloud, AWS as well as certifications in Docker and App Performance Tools such as New Relic. He specializes in Cloud Security, Data Encryption and Container Technologies.

Initial Consultation

Anuj Varma – who has written posts on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.