Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET IIS
I read about AppDomain, but didn't get something.
Assume I have 2 sites A & B. For each site the VirtualDirectory was created in IIS6+. Both sites are under the same ApplicationPool.
I have case with 2 scenarios with questions. Answer please on each question in each scenario.
 
Case:
Request hits IIS for site A. AppDomain is created in ApplicationPool. Appropriate HttpApplication is created in that AppDomain and request is processed.
Scenario1:
Additional request hits IIS for site A. New AppDomain is created and in this new AppDomain HttpApplication is created OR HttpApplication is created in the 1st AppDomain(that was created for 1st Request)?
 
Scenario2:
Additional request hits IIS BUT for site B. New AppDomain is created and in this new AppDomain HttpApplication is created OR HttpApplication is created in the 1st AppDomain(that was created for 1st Request)?
 
Thank you
Posted 21-Oct-10 5:38am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Thats a very good Questtion. I'll try to answer both the scenario.
TheAteist wrote:
Additional request hits IIS for site A. New AppDomain is created and in this new AppDomain HttpApplication is created OR HttpApplication is created in the 1st AppDomain(that was created for 1st Request)

 
If application domain is already there, then it will be used for other request as well.Same HttpApplication class can be used for multiple request.
 

TheAteist wrote:
Additional request hits IIS BUT for site B. New AppDomain is created and in this new AppDomain HttpApplication is created OR HttpApplication is created in the 1st AppDomain(that was created for 1st Request)?

 
No, HTTPApplication is confined into app domain. HTTPApplication object of one site cannot be used by another website.
  Permalink  
Comments
TheAteist at 21-Oct-10 13:57pm
   
Regarding the answer to 1st scenario:
I saw with reflector that HttpApplication is created by HttpApplicationFactory and there is the checking if HttpApplication instances doesn't exceed the maxNumber of HttpApplication instances. So, if 1 HttpApplication can handle all requests, so why there are limitation to HttpApplication instances if only 1 HttpApplication is needed to handle requests?
 
Thank you
Brij at 21-Oct-10 14:43pm
   
At a time single HttpApplication object handles a single request, it may need multiple objects, to cater multiple requests at single point of time. New object is only created when, there is no object or no one is free
TheAteist at 24-Oct-10 7:41am
   
"... it may need multiple objects..." - does "it" refer to "HttpApplication"? If it does, so what "multiple objects" do you talking about?
Alok Kr Sharma at 24-Oct-10 7:49am
   
I mean to say, to handle multiple request at a single point of time, multiple HTTPApplication's object are required. New object is only created when, there is no HTTPApplication object or no HTTPApplication object is free
TheAteist at 25-Oct-10 3:44am
   
I thought you meant that single HTTPApplication object can handle multiply requests at a single point of time(asynchronously). But now I think I get it.
HTTPApplication object can handle only ONE request at a single point of time and when it(HTTPApplication object) finished, so the SAME HTTPApplication object can handle another request, right?
Brij at 25-Oct-10 4:07am
   
Yes you are right. Thanks
TheAteist at 25-Oct-10 4:11am
   
Thank for your help. Can answer another question please?
Single AppPool has ONE AppDomain that has multiply HttpApplication.
Is there any reason that AppPool will create more than ONE AppDomain?
Brij at 25-Oct-10 4:48am
   
Yes, because we can deploy multiple application on a single Application Pool. Every application has a differernt AppDomain. And multiple Appdomain can reside in a single AppPool.
TheAteist at 25-Oct-10 5:21am
   
So if I have site A & B within the same Application Pool, so there are ALWAYS will be 2 AppDomains: 1 for site A and other for site B, right?
Brij at 25-Oct-10 5:36am
   
Each application is run in its own application domain, which is created by the runtime server. Each application domain is isolated from every other application domain.
So as per your question. There will be 2 app domains. one for Site A and another for Site B.
also, Since each application is independent from any other application, this also means that each application has its own independent configuration and control structures
TheAteist at 25-Oct-10 6:23am
   
Now I get the whole picture
Thank you very much:)
Brij at 25-Oct-10 8:19am
   
your welcome. Please mark answer as accepted answer. Yopu can also visit my articles. Some of them may be helpful for you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 21 Oct 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100