It sounds like you need to find out why you are getting new App Domains started. Application_OnStart is suposed to be called when a new app domain is started up.
Now, to get back to your "real" problem. If App domain A is running the whole time, there are ways to make sure that some code only gets run one time. Take a look at the Mutex class. If you grab the mutex in the App_Start and release it in the app_End it may solve your problem. HTH. On 11/13/05, Tony Hal <[EMAIL PROTECTED]> wrote: > I don't know about the timing of the call, but I believe it was getting > called from different app domain. > > The order of the call is also nested. So basically it's like the following: > > - Application_Start (from appdomain A) > > - Application_Start (from appdomain B) > > - Application_End (from appdomain B) > > - Application_End (from appdomanA) > > > > We don't enable the app pool / memory recycling. > > > > The real trouble is that our Application_Start makes a call to an unmanaged > dll through P/Invoke, and the unmanaged dll is actually shared by different > app domains. The global vars defined in the dll are shared by all app > domains in the process. We did not expect this and the code was written not > safe for re-entrant call. If the calls are not nested we'll be ok, but the > fact that they are nested, it messes up the init/termination routine of the > unmanaged codes. > > Btw, we do use II6 under win 2003 server. > > We can fix the problem by making our unmanaged dll to be safe-thread and > safe for re-entrant call, however we are still trying to understand the > behavior of asp.net with respect to this issue. > > Since we don't have app pool recycling, why would this still happen ? Why > are the calls nested ?? Is this documented somewhere ? > > It's important to know this since this affect the correctness of > Application_Start/End implementation. > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com > -- ______________________________ - David Lanouette - [EMAIL PROTECTED] =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com