Stop an asp.net application?

M

mirek

Hi,
How to stop (unload) ASP.NET application? Is it possible? I've some
initialization code in Application_Start and when something is wrong
(bad parameters, cannot connect to db) it throws exception. But it seems
that the application is started even if there were errors. Result is
that the next request doesn't fire Application_Start and my
initialization code is not called.
TIA

Regards,
mirek
 
K

Kevin Spencer

The Application_OnStart method is an Event Handler. It handles an Event
generated by the Application when it starts. In other words, the Event
Handler doesn't start the Application, it only handles an Event that the
Application fires.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
M

mirek

Kevin said:
The Application_OnStart method is an Event Handler. It handles an Event
generated by the Application when it starts. In other words, the Event
Handler doesn't start the Application, it only handles an Event that the
Application fires.

Thanks for the clarification but this doesn't solve my problem. Should I
initialize my objects earlier or in some other way? Should I
understand that I can't control the aplication from the code?

Regards,
mirek
 
A

Alvin Bruney [MVP]

One approach here is to call appdomain unload method. This will force the
application domain to unload firing off the application end event since the
application must stop before the current domain is unloaded. I'll note here
that i haven't tried it so I'm not sure if you will run into issues.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top