Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a problem understanding some functionalities in IIS. Per example I want to know when do I use "Add application", "add virtual directory" or "add website".

Currently I have around 10 websites which are located in my wwwroot/websitename directory and they automatically appear under sites in IIS.

What is the best approach?

share|improve this question
2  
iis.net/learn –  CodeART Nov 2 '12 at 6:47
    
serverfault.com may well be a better place for this question. –  JB King Nov 2 '12 at 20:20
add comment

closed as off topic by maple_shaft Nov 2 '12 at 17:46

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

What are you trying to achieve? Each of these has a different use:

  1. The "Add website" is how multiple sites can be supported on the same server. Thus you could have "www.mysite.com" and "anothersite.mysite.com" using different IPs on the same server but accessing completely different files if you so wish.

  2. The "Add virtual directory" is how you add another folder into your current site to create a "www.mysite.com/thisfolder" routing to a particular folder.

  3. The "Add application" is used when you want to add that folder but run it in another application pool. This can be useful if you want to have separate processes for different parts of a site.


IIS.net would be a site about how to configure and use IIS. Scott Gu's blog is also a good resource for some points in IIS and ASP.Net if you choose to go into that realm of things.


  1. You do understand that the physical path is asking for the root of the website, right? Where should the site start if one is looking at the file system on the server? The binding is what IPs, ports and host headers should be used for this site. Is there a specific IP, port or name you intend to use? If so, this is where that gets set. If you want 5 websites, then you create 4 additional sites besides the default one and configure as needed, perhaps you run each site on a different port. For example, if you type in "http://localhost/site1" and "http://localhost/site2" are you getting into a couple of what you think are different sites even though both run under the localhost site?

  2. If the admin section is in a different part of the file system, yes. The idea of a virtual directory is to allow for the website to use files from multiple places on the system's hard drives. For example, your website could have the "wwwroot/mysite" for its initial location and then reference another disk for where the virtual directory maps which could be on another drive if you wish. The idea is to have "mysite/blah" "mysite/whatever" and "mysite/here" all appear to be next to each other but they don't have to be on the server side as each directory could be mapped to a different location.

  3. The separate processes may be useful if part of your site is less stable and you don't want that application crashing to be impacting the other application pools. Application Pools in Microsoft IIS notes:

You can run as many applications in one application pool as you desire. However, for critical production applications, it is better to set up one application pool per application. This allows each application pool to have its own memory space and errors within one application will not impact other applications running in other pools.

Microsoft .NET Framework does impose a limitation that each Application Pool can only run one version of the Microsoft .NET Framework. So if you have some applications that require Microsoft .NET Framework 1.1 and others that require version 2.0, you must create two different application pools. Note that Microsoft .NET Framework 3.0 and 3.5 are really Microsoft .NET Framework 2.0 from the perspective of all web applications. So there is no requirement to separate applications using version 2.0, 3.0 or 3.5 of Microsoft .NET Framework into separate application pools.

Iron Speed recommends running each application in its own application pool.

ASP.NET Web Garden - How Many Worker Processes Do I Need? also has some answers in terms of worker process stuff that may be of some use from SO. In a way, splitting up a website into multiple applications is like splitting up code into multiple DLLs versus having one big executable. It takes some experimentation and what works in one place may not work in another place.

share|improve this answer
    
Would you know of any resources where I can learn IIS in depth? There are so many questions I have. –  user71631 Nov 2 '12 at 3:21
    
1. If I do sites->Add Website, it asks me for physical path and the binding (unassigned or ip adress with port 80). What should I put if I have let's say 5 websites on my developper computer? 2. I have a Admin section for some of those websites website/admin so then I would use "add virtual directory" ? 3. Can you explain a little more when would I need separate processes for different parts of a site ? Thanks! –  user71631 Nov 2 '12 at 12:03
add comment