473,465 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Do IIS applications "go to sleep"?

Rob
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.
Sep 29 '07 #1
7 4938
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.comwrote in message
news:zu*******************@newsfe3-win.ntli.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
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.


Sep 29 '07 #2
Hi,

ASP.NEt application does have idleTimeOut in <processModelelement 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.comwrote in message
news:zu*******************@newsfe3-win.ntli.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
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.


Sep 29 '07 #3
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.comwrote in message
news:zu*******************@newsfe3-win.ntli.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
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.


Sep 30 '07 #4
Rob
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.
Sep 30 '07 #5
Rob
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.
Sep 30 '07 #6
Rob
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.
Oct 3 '07 #7
Rob
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.
Oct 3 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Karl | last post by:
I work for a software company that's looking to get into .NET. I've dabbled with the technology for a bit, and had some positive resutls. My boss is asking me that he wants to buy a framework...
6
by: Dave | last post by:
I have a stored procedure in sql 2000 that requires steps to be fully completed before moving to the next command in the procedure. I have tried to place the word "GO" after each statement. When I...
6
by: Harald Weiser | last post by:
Hi you out there. I use the following string to go back to a page that's in the history. <A HREF="javascript:history.go('dosearch=0')"> But nothing happens. Using the complete URL makes no...
7
by: John | last post by:
Thanks. I am writing a C++ code on Linux and Sun OS platform. How to make a procedure sleep or delay? Thanks again. "John Carson" <donaldquixote@datafast.net.au> wrote in message...
1
by: Klaus Vestergaard Kragelund | last post by:
Hi there I cannot seem to get this to work. In LabWindows I want to be able to call the Sleep function. But when I #Include "Windows.h" I get errors that it cannot build: "Redeclearation of...
3
by: kiplring | last post by:
Suppose a function which has Sleep() method in it. And I want to recycle it. I made two buttons which call "Resume()" and "Suspend()". But It doesn't work. The state of thread "t" will be...
1
by: Bell, Kevin | last post by:
Does anyone have any experience having python deal with sleep mode? I'd love to run something that would hear a sleep event coming and pickle some data before sleep, then after coming out of...
5
by: Fred Hebert | last post by:
I was thinking of switching to VS2005, so I sent off for and received a 120 evaluation kit. This version was supposed to be the same as the full version, but the key limits you to 120 days. I...
2
by: Lou | last post by:
How can I add a delay in my code. I used to use "Sleep" in VB6 -Lou
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.