Application_End event handler not getting called on developmentserver

T

Tenacious

I am trying to shutdown a database server in the Application_End event
handler on the Global.asax page. So far I am trying this only on the
development server that comes with Visual Studio 2005. When I close
the browser, this does not cause the Application_End event to trigger.
It also will not occur when I shut down the development server. At
this point the application is no longer running, so why didn't the
event handler ever get called?

Any suggestions or guesses will be appreciated.
Thanks
 
J

Juan T. Llibre

re:
!> When I close the browser, this does not cause the Application_End event to trigger

Closing the browser isn't supposed to trigger Application_End.

re:
!> It also will not occur when I shut down the development server

The development server doesn't handle Application_End.
There would be no purpose to doing that because there's no Application Domain to restart.

Test Application_End on IIS.
 
T

Tenacious

re:
!> When I close the browser, this does not cause the Application_End event to trigger

Closing the browser isn't supposed to trigger Application_End.

re:
!> It also will not occur when I shut down the development server

The development server doesn't handle Application_End.
There would be no purpose to doing that because there's no Application Domain to restart.

Test Application_End on IIS.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/






- Show quoted text -

Thanks for taking the time to answer my question. This is my first web
app that I'm doing for my company. One thing that I don't understand
about the web application life cycle is what will ever cause the
application to end when no more requests are coming in? Will it just
continue to remain in memory until the server is shut down? I'm
thinking that there probably is a time out setting somewhere, but I
don't know where it would be at this point.
 
P

Patrice

It depends how the application pool is configured. You could leave it
forever or it could shutdown after a given timeout after the last request...

You may want to be a more specific about what you are trying to do (you
really "shutdown" the database server ???)

---
Patrice

"Tenacious" <[email protected]> a écrit dans le message de
(e-mail address removed)...
re:
!> When I close the browser, this does not cause the Application_End event
to trigger

Closing the browser isn't supposed to trigger Application_End.

re:
!> It also will not occur when I shut down the development server

The development server doesn't handle Application_End.
There would be no purpose to doing that because there's no Application
Domain to restart.

Test Application_End on IIS.

"Tenacious" <[email protected]>
wrote in message






- Show quoted text -

Thanks for taking the time to answer my question. This is my first web
app that I'm doing for my company. One thing that I don't understand
about the web application life cycle is what will ever cause the
application to end when no more requests are coming in? Will it just
continue to remain in memory until the server is shut down? I'm
thinking that there probably is a time out setting somewhere, but I
don't know where it would be at this point.
 
J

Juan T. Llibre

re:
!> Thanks for taking the time to answer my question.

No prob. I love helping others, like I was helped by many.

re:
!> One thing that I don't understand about the web application life cycle is what
!> will ever cause the application to end when no more requests are coming in?

You can configure IIS 6.0 and 7.0 to recycle the application pool the application lives in.

You can recycle the worker processes by :

....in the "Recycling tab
1. the number of minutes which have gone by since the application was started.
2. the total number of requests which have been made
3. a particular time of day which you define
4. the maximum amount of memory which you want the application to use
( For both physical and virtual memory. You can set different thresholds for each )

or...in the "Performance" tab
5. you can shutdown the worker process when the process has been idle for a soecified number of minutes

You set these parameters in the IIS Manager.
Scroll on the left to the "Application Pools" section, right click any Application Pool and select "Properties".

Experiment with the settings but don't set the thresholds too high, as that may affect performance.

For example: total memory consumption shouldn't be higher than 60% of your installed RAM.
I use 40% ( with 2GB RAM installed, so IIS will recycle the pools when they reach 800MB RAM used ).

That has never happened. At most, they have gotten to about 200MB.

I do recycle on other parameters, though.
You can set several options so if one doesn't occur another one will.

It's important to recycle your application pools before their excessive RAM usage clogs up your server.




re:
!> When I close the browser, this does not cause the Application_End event to trigger

Closing the browser isn't supposed to trigger Application_End.

re:
!> It also will not occur when I shut down the development server

The development server doesn't handle Application_End.
There would be no purpose to doing that because there's no Application Domain to restart.

Test Application_End on IIS.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/






- Show quoted text -

Thanks for taking the time to answer my question. This is my first web
app that I'm doing for my company. One thing that I don't understand
about the web application life cycle is what will ever cause the
application to end when no more requests are coming in? Will it just
continue to remain in memory until the server is shut down? I'm
thinking that there probably is a time out setting somewhere, but I
don't know where it would be at this point.
 
B

bruce barker

you also need to be careful of what you put in application end events.
shutting down another service may cause problems.

if asp.net performs a recycle (code/config change, too much memory,etc), a
new appdomaiin is started and the old one shutdown. its application_start may
fire before the old appdomain application_end fires.

-- bruce (sqlwork.com)
 

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

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top