http://www.c-sharpcorner.com/Interviews/answer/5761/what-is-the-difference-between-appdomain-and-application-pool
Application pool and App-domain , both of them can provide isolation's, but use different approaches. Application pool use the process to isolate the applications which works without .NET. But App-domain is another isolation methods provided by .NET. If your server host thousands of web sites, you wont use thousands of the application pool to isolate the web sites, just because, too many processes running will kill the OS. However, sometime you need application pool. One of the advantages for application pool is that you can config the identity for application pool. Also you have more flexible options to recycle the application pool. At least right now, IIS didn't provide explicit options to recycle the app-domain.
If you only have a single site in your app pool, then an app pool and an App-domain recycle will be quite similar. The app pool recycle will recycle the entire w3wp.exe process while the App-domain will recycle the .NET App-domain only, but since most of what that needs to be recycled lives in the App-domain, they will achieve the same thing. It's just a matter of which is easier for you to do. But, if the App-domain recycle doesn't do the trick, then try a full app pool recycle. This will depend on your situation.
If you have multiple sites in the app pool, then an App-domain is preferred because it won't touch any of the other sites or applications in the app pool and is isolated to just the single application/App-domain in the app pool.
If you only have a single site in your app pool, then an app pool and an App-domain recycle will be quite similar. The app pool recycle will recycle the entire w3wp.exe process while the App-domain will recycle the .NET App-domain only, but since most of what that needs to be recycled lives in the App-domain, they will achieve the same thing. It's just a matter of which is easier for you to do. But, if the App-domain recycle doesn't do the trick, then try a full app pool recycle. This will depend on your situation.
If you have multiple sites in the app pool, then an App-domain is preferred because it won't touch any of the other sites or applications in the app pool and is isolated to just the single application/App-domain in the app pool.
Posted by prakash Varanasi on Dec 21, 2012
- 0
Please see my answer below for the differences between appdomain and application pool...
1. Basically, an application is an IIS term, which will create a sandbox, or a set of boundaries in order to separate different sites, or parts of sites, from the others.
2. AppDomain is a .NET term, which contains InProc session state so that if an AppDomain is killed or recycled, all of your session state information will be lost.
3. Applications can have multiple AppDomains in them, although most of the time there is a one-to-one relationship between them.
4. In IIS6 and greater, there is the option of creating groups or "pools" of applications that can be bundled together or separated, however, it will decide by server administer. These are called Application Pools. Each application pool runs under its own w3wp.exe worker process.
5. In IIS, it is easy to see an application. A new website is a separate application and any sub-folder can be marked as an application. When they are, the icon beside the folder turns into a picture of some gears. By right-clicking on the folder, you have the option of marking a folder as an application or removing it as an application, if it already is one. Also, in IIS6, in the Application Pools section, you can see all of the applications and which application pool they live under.
6. On the other hand, ASP.NET does not give much visibility into AppDomains, at least not from any visual tools. This is done behind the scenes. Programmatically, you can create them, tear them down or see a list of all running AppDomains.
7. You can recycle an application from IIS. In IIS5, you cannot do it directly unless you recycle the entire web server, but in IIS6 and greater, you can recycle the application pool that the application lives under. It will gracefully die off and a new application will start up to replace it. Or, to word it another way, another w3wp.exe worker process will be started and then the old one will die off after it completes any currently running page requests.
8. You can recycle an AppDomain in ASP.NET through the "touch trick". There are some ways to do it, but the most straightforward is to edit your web.config file in notepad and add a space to an insignificant place. Then save the file. This will cause the AppDomain to recycle. This does not touch the IIS application though.
9. Recycling an AppDomain will come pretty close to starting ASP.NET freshly again for that particular ASP.NET application, so although it does not recycle the application pool, it can give ASP.NET a fresh start in many situations.
1. Basically, an application is an IIS term, which will create a sandbox, or a set of boundaries in order to separate different sites, or parts of sites, from the others.
2. AppDomain is a .NET term, which contains InProc session state so that if an AppDomain is killed or recycled, all of your session state information will be lost.
3. Applications can have multiple AppDomains in them, although most of the time there is a one-to-one relationship between them.
4. In IIS6 and greater, there is the option of creating groups or "pools" of applications that can be bundled together or separated, however, it will decide by server administer. These are called Application Pools. Each application pool runs under its own w3wp.exe worker process.
5. In IIS, it is easy to see an application. A new website is a separate application and any sub-folder can be marked as an application. When they are, the icon beside the folder turns into a picture of some gears. By right-clicking on the folder, you have the option of marking a folder as an application or removing it as an application, if it already is one. Also, in IIS6, in the Application Pools section, you can see all of the applications and which application pool they live under.
6. On the other hand, ASP.NET does not give much visibility into AppDomains, at least not from any visual tools. This is done behind the scenes. Programmatically, you can create them, tear them down or see a list of all running AppDomains.
7. You can recycle an application from IIS. In IIS5, you cannot do it directly unless you recycle the entire web server, but in IIS6 and greater, you can recycle the application pool that the application lives under. It will gracefully die off and a new application will start up to replace it. Or, to word it another way, another w3wp.exe worker process will be started and then the old one will die off after it completes any currently running page requests.
8. You can recycle an AppDomain in ASP.NET through the "touch trick". There are some ways to do it, but the most straightforward is to edit your web.config file in notepad and add a space to an insignificant place. Then save the file. This will cause the AppDomain to recycle. This does not touch the IIS application though.
9. Recycling an AppDomain will come pretty close to starting ASP.NET freshly again for that particular ASP.NET application, so although it does not recycle the application pool, it can give ASP.NET a fresh start in many situations.
******************
This question normally arises when configuring web applications.
To summarize, an AppPool consists of one or more processes. Each web application that you are running consists of (usually, IIRC) one application domain. The issue is when you assign multiple web applications to the same AppPool, while they are separated by the application domain boundary they are still in the same process. This can be less reliable/secure than using a separate AppPool for each web application. On the other hand, it can improve performance by reducing the overhead of multiple processes.
ASP.NET has its own forums. I'd recommend you ask there if you have additional questions about how to set up ASP.NET: http://forums.asp.net/
Here are some quotes from the documentation:
Application Pool
[quote]
An Internet Information Services (IIS) application pool is a grouping of URLs that is routed to one or more worker processes. Because application pools define a set of Web applications that share one or more worker processes, they provide a convenient way to administer a set of Web sites and applications and their corresponding worker processes. Process boundaries separate each worker process; therefore, a Web site or application in one application pool will not be affected by application problems in other application pools. Application pools significantly increase both the reliability and manageability of a Web infrastructure.
[/quote]
Application Domain
[quote]
A boundary that the common language runtime establishes around objects created within the same application scope (that is, anywhere along the sequence of object activations beginning with the application entry point). Application domains help isolate objects created in one application from those created in other applications so that run-time behavior is predictable. Multiple application domains can exist in a single process.
[/quote]
IIS _Application Pool_more than one W3Wp is called web farm.png
An application pool is a container to execute one or more applications/virtual directories, which means for a single application pool, one or more than one websites can be mapped. In a application pool, more than one worker processor can exists. if each website in application pool is mapped to individual worker process, and if any issues occurs in one worker process, only that worker process will
stored and restart, the other process will still run.
Application domain is mapped to individual worker process, that is w3wp.exe. but, there can be more than one application domain mapped to a single worker process.
Application vs. AppDomain
A question was asked on a forum that I frequent which I thought was worth writting a blog about.
Q: What is the difference between an application and an Appdomain? I understand from my research so far that an Appdomain is a container within which ASPX runs and that Apppool is a process that starts the w3wp.exe worker process within which ASP applications run.
A: That’s a good question. Here are some key differences:
- An application is an IIS term, but it’s one that ASP.NET utilizes. Essentially it creates a sandbox, or a set of boundaries to separate different sites, or parts of sites, from the others.
- An AppDomain is a .NET term. (In IIS7, AppDomains play a larger role within IIS, but for the most part it’s anASP.NET term)
- An AppDomain contains InProc session state (the default session state mode). So if an AppDomain is killed/recycled, all of your session state information will be lost. (if you are using the default InProc session state)
- Applications can have multiple AppDomains in them although often times there is a one-to-one relationship between them.
- In IIS6 and greater, there is the option of creating groups, or “pools” of applications that can be bundled together or separated; however the server administer decides. These are called Application Pools. Each app pool runs under its own w3wp.exe worker process.
- In IIS, it’s easy to see an application. A new website is a separate application and any subfolder can be marked as an application. When they are, the icon beside the folder turnes into a picture of some gears. By right-clicking on the folder, you have the option of marking a folder as an application or removing it as an application, if it already is one. Also, in IIS6, in the Application Pools section, you can see all of the applications and which app pool they live under.
- ASP.NET, on the other hand, doesn’t give much visibility into AppDomains, at least not from any visual tools. This is done behind the scenes. Programmatically you can create them, tear them down or see a list of all running AppDomains.
- You can recycle an application from IIS. In IIS5, you can’t do it directly unless you recycle the entire web server, but in IIS6 and greater, you can recycle the application pool that the application lives under. It will gracefully die off and a new application will start up to replace it. Or, to word it another way, another w3wp.exe worker process will be started and then the old one will die off after it completes any currently running page requests.
- You can recycle an AppDomain in ASP.NET through the ‘touch trick’. There are a few ways to do it, but the most straight forward is to edit your web.config file in notepad and add a space to an insignificant place. Then save the file. This will cause the AppDomain to recycle. This *does not* touch the IIS application though.
- Recycling an AppDomain will come pretty close to starting ASP.NET fresh again for that particular ASP.NETapplication, so although it doesn’t recycle the apppool, it can give ASP.NET a fresh start in many situations.
- http://csharp-video-tutorials.blogspot.com/2012/12/application-pools-in-iis-part-82.html
No comments:
Post a Comment