PC Review


Reply
Thread Tools Rate Thread

Do IIS applications "go to sleep"?

 
 
Rob
Guest
Posts: n/a
 
      29th Sep 2007
In a previous thread, I was asking about setting up my global.aspx which
inherits System.Web.HttpApplication. This is where there are the event
handlers like:

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

In this file I've got:

Private WithEvents ApplicationTimer As System.Timers.Timer ' used to
generate application events

and the associated:

Private Sub ApplicationTimer_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles ApplicationTimer.Elapsed

This works fine but for some reason, the timer stopped running after a
while. I had left the application idle on the web server. Do application
events continue to run forever even after all sessions on the webapp have
timed out/finished?

Cheers, Rob.


 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      29th Sep 2007
Hi,

ASP.NEt application does have idleTimeOut in <processModel> element in
machine.config which specifies the time after worker process will shut down
if the app is idle. This setting applies in Windows 2000/XP/2003 (2003 only
in IIS 5.0 isolation mode).

If you use Windows Server 2003 in worker process isolation mode (not IIS 5.0
isolation mode), then application pool's settings apply.
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net





"Rob" <rob_nicholson@nospam_unforgettable.com> wrote in message
news:zusLi.43650$(E-Mail Removed)...
> In a previous thread, I was asking about setting up my global.aspx which
> inherits System.Web.HttpApplication. This is where there are the event
> handlers like:
>
> Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
>
> In this file I've got:
>
> Private WithEvents ApplicationTimer As System.Timers.Timer ' used to
> generate application events
>
> and the associated:
>
> Private Sub ApplicationTimer_Elapsed(ByVal sender As Object, ByVal e As
> System.Timers.ElapsedEventArgs) Handles ApplicationTimer.Elapsed
>
> This works fine but for some reason, the timer stopped running after a
> while. I had left the application idle on the web server. Do application
> events continue to run forever even after all sessions on the webapp have
> timed out/finished?
>
> Cheers, Rob.
>
>



 
Reply With Quote
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      29th Sep 2007
IIS will dispose of the application eventually to improve performance and
release resources used by the application. Usually, this happens after the
last session times out, then application_end is called and the application
is removed. That's why when an ASP.Net app has been idle for a period of
time the first hit takes longer since it's recompiling and creating the new
application instance again.


--
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Rob" <rob_nicholson@nospam_unforgettable.com> wrote in message
news:zusLi.43650$(E-Mail Removed)...
> In a previous thread, I was asking about setting up my global.aspx which
> inherits System.Web.HttpApplication. This is where there are the event
> handlers like:
>
> Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
>
> In this file I've got:
>
> Private WithEvents ApplicationTimer As System.Timers.Timer ' used to
> generate application events
>
> and the associated:
>
> Private Sub ApplicationTimer_Elapsed(ByVal sender As Object, ByVal e As
> System.Timers.ElapsedEventArgs) Handles ApplicationTimer.Elapsed
>
> This works fine but for some reason, the timer stopped running after a
> while. I had left the application idle on the web server. Do application
> events continue to run forever even after all sessions on the webapp have
> timed out/finished?
>
> Cheers, Rob.
>
>



 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      30th Sep 2007
One thing to remember is web applications are designed to be stateless. The
idea is there is a request from a client (generally a browser) and a
response from the server. To fake a session, a server cookie is set on the
client side. This type of cookie is not disabled when one disables client
cookies, so do not think of this as your typical cookie, except that both
send their information with every request. State is an illusion created by
using these session items (like a server cookie).

Now that you have that down, consider what happens to sessions that do not
need your timer when you extend a session timeout to five days. Everyone who
hits the application takes up memory for five days, or until the application
dies.

If you need a timer to run, you are better to set up a windows service that
will handle the timer. You can fire it off from your web application, if you
would like, but consider it a one way trip.

Short answer: You can configure this "timer" to stay up longer, but you may
end up with some bad effects.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
"Rob" <rob_nicholson@nospam_unforgettable.com> wrote in message
news:zusLi.43650$(E-Mail Removed)...
> In a previous thread, I was asking about setting up my global.aspx which
> inherits System.Web.HttpApplication. This is where there are the event
> handlers like:
>
> Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
>
> In this file I've got:
>
> Private WithEvents ApplicationTimer As System.Timers.Timer ' used to
> generate application events
>
> and the associated:
>
> Private Sub ApplicationTimer_Elapsed(ByVal sender As Object, ByVal e As
> System.Timers.ElapsedEventArgs) Handles ApplicationTimer.Elapsed
>
> This works fine but for some reason, the timer stopped running after a
> while. I had left the application idle on the web server. Do application
> events continue to run forever even after all sessions on the webapp have
> timed out/finished?
>
> Cheers, Rob.
>
>



 
Reply With Quote
 
Rob
Guest
Posts: n/a
 
      30th Sep 2007
> Now that you have that down, consider what happens to sessions that do not
> need your timer when you extend a session timeout to five days. Everyone
> who hits the application takes up memory for five days, or until the
> application dies.


The session doesn't need extending to five days, just need to ensure that
the application itself keeps running for longer than the last session
timeout (30 mins I think at the moment). The timer routine is actually used
to send an email summary of the user's action an hour after they last made
any changes. Therefore I just need the application to stay alive for a
couple of hours.

> If you need a timer to run, you are better to set up a windows service
> that will handle the timer. You can fire it off from your web application,
> if you would like, but consider it a one way trip.


Appreciate that but it complicates the architecture of the application
considerably. I'll investigate idleTimeOut setting that was mentioned.

Cheers, Rob.


 
Reply With Quote
 
Rob
Guest
Posts: n/a
 
      30th Sep 2007
> is removed. That's why when an ASP.Net app has been idle for a period of
> time the first hit takes longer since it's recompiling and creating the
> new application instance again.


I always wondered why that happened.

Cheers, Rob.


 
Reply With Quote
 
Rob
Guest
Posts: n/a
 
      3rd Oct 2007
> If you use Windows Server 2003 in worker process isolation mode (not IIS
> 5.0 isolation mode), then application pool's settings apply.


How do you check if it's running in worker process isolation mode?

And what is worker process isolation mode? :-)

Thanks, Rob.


 
Reply With Quote
 
Rob
Guest
Posts: n/a
 
      3rd Oct 2007
> How do you check if it's running in worker process isolation mode?

It's okay - I found it on the website properties tag. I'm not running in IIS
5.0 isolation mode so I've changed the idle timeout on the application pool
from 20 minutes to 120 which should work a treat.

Cheers, Rob.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows XP(Home) "Sleep" & "WakeUp" Keys & HIBERNATE. =?Utf-8?B?RG91Z2xhcy5OIChVSyk=?= Windows XP New Users 2 26th Oct 2007 11:21 AM
Vista "Sleep" and "Hibernate" arent working. =?Utf-8?B?Q2hhZEJlZGluZ2Vy?= Windows Vista Performance 0 5th Feb 2007 08:26 PM
constant "hanging up" various applications showing "hungapp" digimom Windows XP Help 1 24th Jun 2006 12:29 AM
respond to "go to sleep" and "wake up" events Dan Microsoft Dot NET Compact Framework 2 14th Jun 2006 07:25 AM
Applications Shutdown with "c0000006 (in page io error)" or "c0000005 (access v" Mike Wolfe Microsoft Windows 2000 Terminal Server Applications 1 16th Dec 2003 09:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:08 PM.