10

I am asp.net developer , I am always confused between application and virtual directory in IIS.It seems that in iis 6.0 ,you can only create virtual directory.

  • 1
    In IIS6 you create a virtual directory and then convert it to an application. – Mark Henderson Jan 14 '10 at 3:01
13

Those two are easy to get confused and people often use the terms interchangeably.

A virtual directory is just a pointer to a different location on disk. It points to a fixed path on disk that is different that its parent folder.

An application is a boundary between different folders. ASP.NET uses it to create a new AppDomain root (or application root). An application root uses a different global.asax, bin folder and the other app_[folders.].

In IIS6 and IIS7 if you create a virtual directory, it is not also an application by default. ASP.NET will put it in the same AppDomain as its parent folder.

In IIS6 you can convert a virtual directory or a regular folder into an application by right-clicking -> properties and Create.

In IIS7 the options are named different but it's the same in the background. Creating a virtual directory allows you to create a vdir that is still part of its parent's AppDomain i.e. not an application).

The "Add Application" option actually creates a virtual directory AND then marks it as an application. (you'll notice that it allows you to specify a path).

You can also right-click on an existing folder (or vdir) and Convert to Application. That's a way to create the application boundary on a existing regular or virtual folder.

  • Default Web Site on my IIS 7 is running MOSS 2007 (SharePoint). Since I want users to feel like they are still on the portal, I created a similarly branded ASP.NET web application and set it up as a virtual directory based application under the same site. Both the Default Web Site and this ASP.NET application are using the same application pool. First of all, is this safe/good practice? Secondly, if I enable and use session in the ASP.NET application, will that in any way jeopardize the integrity/performance of SharePoint managed session, of affect SharePoint in any other way? – Web User Oct 3 '15 at 13:13
  • @WebUser It's ok to have them in the same app pool, and since they are separate applications in the app pool, the session state will be separate and isolated from each other. However, I recommend using a separate app pool anyway. If something does fail in one, you don't have to take both down to recycle or fix the other. And you'll have more flexibility to lock down the NTFS permissions to isolate them from from each other. – Scott Forsyth - MVP Oct 5 '15 at 1:57
  • @ScottForsyth-MVP I did heed to your suggestion since I wanted them to be totally isolated. I created a new application pool and a new service account, and used this article to set up the identity. I don't know why but the application throws a System.UnauthorizedAccessException after taking a while to display the page; the application is still functional but it is slow and yields the exception prompting me to open Visual Studio. Any thoughts on what I am missing? – Web User Oct 5 '15 at 2:11
  • @ScottForsyth-MVP can you please look at this question I posted on ServerFault? Thanks! – Web User Oct 5 '15 at 6:28
  • @WebUser. It's probably that your custom identity needs to be added to the IIS_WPG group. That was a requirement in IIS6. I replied to your other post too. – Scott Forsyth - MVP Oct 6 '15 at 1:02
2

You can also check.. Did you know: Difference between Virtual Directory & Application in IIS 7 / 7.5

Edited: To quote the site, as the link is dead;

In IIS 7 / 7.5, you have an option to create a Virtual Directory and Applications.

What is a Virtual Directory?

Virtual Directory is a directory that is mapped to a local physical directory or a directory on a remote server. A Virtual Directory will have it's code executed in the same worker process as the parent process. The application pool of the Web Site and Virtual Directory is the same.

Image05

What is an Application?

An Application is identical to the Virtual Directory except that you have an option to run an Application in a different application pool.

Image06

NOTE: this is how the above screenshots looks like in applicationhost.config

0

A virtual directory is nothing but, is just pointing or refers to your folder in your local machine or remote server. If you are create virtual directory under Default Web Site in IIS. Suppose if default web site got crashed due to some internal problem you cannot access your virtual directory.

Add application is nothing but, is a group of files that delivers content or provides services over protocols. An application belongs to an application pool; suppose due to some problem default web site got crashed it won’t affect the any application which are belongs to application pool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.