开发者

is HttpApplication.Init () method get fired only once?

Upon startup of my ASP.NET 4.0 application, I increase count of my application variable inside an override of HttpApplication.Init (). When application runs first time the init method will get called and count will be 1. I noticed that when next time application gets called init method will not get executed and count will always be remained 1.

Is this intended behavior or I am doing something wrong, or my understanding on the HttpApplication.init () is wrong.

Any hel开发者_运维技巧p would be appreciated!

Thanks, Pradeep


HttpApplication object is used to process a HTTP request. These are similar to connections and are expensive to create, so the worker process will instantiate as many required and create a pool for the same. Now every request is served by the objects in this pool.


Yes, this in the intended behavior: the Init method is designed to only fire once in order to allow you 'to add custom one-time initialization code'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜