Comparing Virtual Directories to Applications

It is easy to get virtual directories and applications confused. In IIS 8.0, there is a clear line of separation between them. This chapter is about applications and application pools, not virtual directories, but before moving on, it's important to understand the differences between them.

As stated in the preceding section, an application is a logical boundary that separates data and subsections of a site. A virtual directory is the actual pointer to a local or remote physical path. A virtual directory must always exist inside an application, and applications can contain multiple virtual directories.

Consider the following section from applicationHost.config:

<site name="Default Web Site" id="1">
   <application path="/">
      <virtualDirectory path="/"
        physicalPath="D:\websites\wwwroot" />
   </application>
   <application path="/Section2">
      <virtualDirectory path="/"
        physicalPath="D:\websites\wwwroot\Section2" />
   </application>

   <bindings>
     <binding protocol="http" bindingInformation="*:80:" />
   </bindings>
</site>

This section shows applications and virtual directories. One application is the Root Application (/), and the other is /Section2. Each of these contains a virtualDirectory: one points to D:\websites\wwwroot, which is the site root, and the other points to D:\websites\wwwroot\Section2, which is a second part of the same site. Because these folders are in two different applications, they will not share the application files and folders. ...

Get Professional Microsoft IIS 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.