S
SL
All,
As I understand it, a single application (i.e. IIS virtual directory)
in ASP.NET may in fact have more than one corresponding
HttpApplicationState object (more or less one per server thread, I
think). During each request, only one of these objects is exposed to
the page as Page.Application. This seems to be supported by the fact
that when I use the debugger, I can see the Application_Start event
firing more than one time even though IIS has not been shut down in
between.
My question is this - within my application, I want to instantiate a
specific COM object, and then I want to store this one instance some
place where it will a) remain until IIS shuts down and b) is
accessible by all pages, during all requests, regardless of exactly
which application object is being used by each request. Due to the
way that this particular COM component was written, I can only have
one instance of the COM object in question at any time. If I try to
have more than one instance exist concurently, they both enter an
invalid state and can no longer be used.
What I initially tried was instantiating my object on
Application_Start, and then saving myObject to the application object.
But later on, Application_Start invariably fires again and I end up
re-creating the object, because I can not see it on the current
application object. Meanwhile the original application object still
has its own instance of my COM object, so two instances now exist but
they both enter an invalid state.
Any help would be greatly appreciated.
As I understand it, a single application (i.e. IIS virtual directory)
in ASP.NET may in fact have more than one corresponding
HttpApplicationState object (more or less one per server thread, I
think). During each request, only one of these objects is exposed to
the page as Page.Application. This seems to be supported by the fact
that when I use the debugger, I can see the Application_Start event
firing more than one time even though IIS has not been shut down in
between.
My question is this - within my application, I want to instantiate a
specific COM object, and then I want to store this one instance some
place where it will a) remain until IIS shuts down and b) is
accessible by all pages, during all requests, regardless of exactly
which application object is being used by each request. Due to the
way that this particular COM component was written, I can only have
one instance of the COM object in question at any time. If I try to
have more than one instance exist concurently, they both enter an
invalid state and can no longer be used.
What I initially tried was instantiating my object on
Application_Start, and then saving myObject to the application object.
But later on, Application_Start invariably fires again and I end up
re-creating the object, because I can not see it on the current
application object. Meanwhile the original application object still
has its own instance of my COM object, so two instances now exist but
they both enter an invalid state.
Any help would be greatly appreciated.