Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Web App and Virtual Folder in the context of IIS 7.x?

Tags:

iis

As I deploy my web site, I found that I could convert a folder into a virtual folder or web application, I am totally confused about these 2 concepts.

  • Why there are two different types?

  • What's the purpose of each?

like image 593
smwikipedia Avatar asked Mar 31 '11 13:03

smwikipedia


People also ask

What is the difference between virtual directory and application in IIS?

Virtual directories and applications are now separate objects, and they exist in a hierarchical relationship in the IIS configuration schema. Briefly, a site contains one or more applications, an application contains one or more virtual directories, and a virtual directory maps to a physical directory on a computer.

What is a virtual directory in IIS?

A virtual directory is a directory name (also referred to as path) that you specify in Internet Information Services (IIS) 7 and map to a physical directory on a local or remote server.

What is a virtual directory on a Web server?

A virtual directory is a path or alias within a website that refers users to another directory where the actual data is hosted. The referred directory can be a physical directory on a local server's hard drive or a directory on another server (network share).

How do I convert virtual directory to application in IIS?

In IIS Manager, expand the node for the local computer and then expand the Sites folder. Right-click the folder that you want to convert to an application and then click Convert to Application. The Add Application dialog box is displayed. Click OK.


2 Answers

A Virtual Folder or Virtual Directory is just a link to a physical folder somewhere on the server. This folder becomes part of the website structure and you can use the virtual directory in the path part of URLs. Code that executes in Virtual Directories will execute in the same "Application" as it's parent.

An Application is where the code that runs inside that "folder" has it's own Session state and Application state. It is in effect a new standalone application living underneath the root application.

For example, if you were to deploy an ASP.NET application into a site that had an Application folder called /myapp then that application would have it's own application domain, session state, application state completely separate from another ASP.NET application running in /. For example: if you set an Application value Application["Thing"] = 123 in the root application and then did the same but with a different value in /myapp then Application["Thing"] in the root would not be overwritten by the assignment in /myapp.

Another thing you can do with Application's is specify a different Application Pool to run under. For example your root / application might contain an ASP.NET 2.0 application and run in a pool configured for .NET 2.0. However you may want to run a blog or forum application written in ASP.NET 4.0. Now because you can't mix ASP.NET runtime versions in the same application pool, you can specify an alternative application pool specifically for ASP.NET 4.0 applications.

Applications can also behave like Virtual Directories and you can point an application folder at a physical folder elsewhere on the server.

If you're interested in the underlying mechanics of Virtual Directories and Applications on IIS7 then have a look at this answer I posted a while back:

Using ServerManager to create Application within Application

like image 122
Kev Avatar answered Oct 17 '22 05:10

Kev


To add an informational detail to what Kev has very nicely mentioned - All virtual directories by default run under a pre-defined app pool named DefaultAppPool. DefaultAppPool comes by default with IIS whenever you enable this feature in windows. For WebApps you can always create fresh/new appPools and run your webApp inside your newly created appPool. These appPools provide you that physical/separate process space (in form of worker processes) with the help of which IIS is able to provide services like sessions state, application state etc in silos to a webApp when it has its own appPool defined. Whenever your webApp's appPool crashes, the other webApps (using their own custom appPool) or virtual directories (using DefaultAppPool appPool) remain completely unaffected.

like image 28
RBT Avatar answered Oct 17 '22 06:10

RBT