IIS & Application Pool & App Domain & ...

http://stackoverflow.com/questions/13319996/httpmodules-and-global-asax-asp-net-page-life-cycle

ASP.NET applications in IIS are structured like my image below. I know it is probably scary looking but the names should sound familiar. Hopefully the familiar names make it a little more digestible.

I'm not going to rehash in words the structure you see below. The picture does a better job then I could ever say in sentences. Instead, I'll jump right in to the implications the image has for your questions.


App Domain
What is an App Domain? It is as a private allotment of system memory for an application. All code inside the domain uses the allocated domain memory. This means static types and references are shared in a domain. All code outside the domain can't access the domain's memory.

Every ASP.NET application is runs inside one App Domain for each App Pool it belongs to. This one to one relationship holds true regardless of the thread count in an App Pool.

Global.asax
What is Global.asax? At its simplest it is a .NET class that inherits from System.Web.HttpApplication.HttpApplication gives Global.asax the smarts to guide all HTTP Requests through the request pipeline. It will fire all the request life-cycle events and call ProcessRequest on the handler.

Each ASP.NET application will create multiple instances of HttpApplication (Global.asax). When a request is received it will be handed to one of the HttpApplication instances. The request will then stay with the sameHttpApplication instance for its lifetime. This means there is one HttpApplication instance per request being handled. Every HttpApplication instance can, and will, be reused to handle many requests during its lifetime.

Aplication Events
Where do the Application events like Application_Start tie in? That depends since some of these events refer to the App Domain and some to HttpApplication. Application_Start and Application_End refer to the start and end of the App Domain. The rest of the Application events (e.g. Application_Begin) refer to the life-cycle of anHttpApplication instance.

More Information
For more information I suggest this MSDN article and this non-MSDN article.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值