Hello csprakash@yahoo.com,
What exactly behavior u need and why Application_Start is inappropriate?
Im not quite understand how u gonna hook the AppDomain when asp.net starts
to add AppDomainInitializer event
---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
> Hi All,
> I want to run some user when an Application is started, or when a
[quoted text clipped - 12 lines]
> Thanks,
> Ashto
Ashton - 14 Jan 2008 23:08 GMT
My requirement is - I have a time consuming Initialization that needs
to be done before any page is accessed on the site. At present I am
using Application_Start. The initialization takes around 3 minutes.
-------------
Application_Start(..)
{
.....
myObj = new MyClass(); // takes 3 minutes, performs singleton type of
initialization internally
}
-------------
So, when I first access the site, the browser looks frozen. I dont
want the initialization to wait till a request comes, if it can start
as soon as the IIS ApplicationPool is started or recycled, that will
be ideal.
I had few alternatives, but none of them are elegant:
1)
On a machine restart, after IIS service comes up, I can have a bat
script which tries to access the site, which performs the
intialization.
This works fine, but the worker processes need to be recycled
every hour or so for some data requirement. Whenever the worker
process is recycled, it waits till it receives the first request for
the Application. On the first request, the users feel the site is
frozen.
2) tried various other methods in Global.asax.cs (HttpApplication),
------------
init()
{
.....
myObj = new MyClass(); // takes 3 minutes, performs singleton type of
initialization internally
}
---------
static global()
{
.....
myObj = new MyClass(); // takes 3 minutes, performs singleton type of
initialization internally
}
but both of them are invoked on the first http request to the
Application.
3) I came across Microsoft.Web.Administration ServerManager, Site,
ApplicationPool, ApplicationDomain classes. Can anyof them be used to
start HttpApplication even before an external http request comes?
Regards