Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

Do IIS applications "go to sleep"?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob - 29 Sep 2007 14:33 GMT
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.
Teemu Keiski - 29 Sep 2007 15:09 GMT
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.
Signature

Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

> 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
[quoted text clipped - 19 lines]
>
> Cheers, Rob.
Rob - 03 Oct 2007 16:42 GMT
> 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.
Rob - 03 Oct 2007 16:53 GMT
> 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.
Mark Fitzpatrick - 29 Sep 2007 15:11 GMT
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.

Signature

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

> 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
[quoted text clipped - 19 lines]
>
> Cheers, Rob.
Rob - 30 Sep 2007 19:26 GMT
> 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.
Cowboy (Gregory A. Beamer) - 30 Sep 2007 03:42 GMT
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.

Signature

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

*************************************************

| Think outside the box!

*************************************************
> 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
[quoted text clipped - 19 lines]
>
> Cheers, Rob.
Rob - 30 Sep 2007 19:26 GMT
> 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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.