You will get an Application_Start for each HttpApplication object
ASP.NET runtime creates as many instances of application class as is need
to process requests simultaneously. For most applications this number is
limited to the number of threads, and would stay in 1-100 range depending
on the hardware, server load, configuration, etc. Application instances are
reused for many requests, and a free list of application instances is kept
during the periods of reduced load. Application instances are utilized in a
thread safe manner, one request at a time. This has important implications:
Users don't need to worry about locking, to access non-static members of
the application class.
Application code can store per-request data in non-static members of the
application class (but not after EndRequest event, as it would keep the
request alive potentially for a long time).
Static members of application class, as of any class, are not thread safe,
and the user code needs to provide appropriate locking around access to
Andy Mortimer [MS]
Please do not send email directly to this alias. This alias is for
newsgroup purposes only
This posting is provided "AS IS" with no warranties, and confers no rights.
OR if you wish to include a script sample in your post please add "Use of
included script samples are subject to the terms specified at
Andy Mortimer [MS]
The Application_OnStart Method is an Event Handler. As such, it will not
fire more than once, when the first request is received. There is no real
"simultaneous" request, although at the speed with which they are processed
it might seem so. Requests are queued.
Big things are made up
of lots of little things.
"RB" <> wrote in message
> Is it guaranteed that Application_Start() will only run once per
> start? In other words, what happens if 2 users simultaneousy hit a
> app? Does ASP.NET know to run only one thread?
The Application_Start and Application_End methods are special methods that do not represent HttpApplication events. ASP.NET calls them once for the lifetime of the application domain, not for each HttpApplication instance.