473,791 Members | 3,122 Online
Bytes | Software Development & Data Engineering Community
+ 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.Http Application. This is where there are the event
handlers like:

Sub Session_Start(B yVal sender As Object, ByVal e As EventArgs)
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)

In this file I've got:

Private WithEvents ApplicationTime r As System.Timers.T imer ' used to
generate application events

and the associated:

Private Sub ApplicationTime r_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.E lapsedEventArgs ) Handles ApplicationTime r.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 4979
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_unforget table.comwrote in message
news:zu******** ***********@new sfe3-win.ntli.net...
In a previous thread, I was asking about setting up my global.aspx which
inherits System.Web.Http Application. This is where there are the event
handlers like:

Sub Session_Start(B yVal sender As Object, ByVal e As EventArgs)
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)

In this file I've got:

Private WithEvents ApplicationTime r As System.Timers.T imer ' used to
generate application events

and the associated:

Private Sub ApplicationTime r_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.E lapsedEventArgs ) Handles ApplicationTime r.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 <processModelel ement 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_unforget table.comwrote in message
news:zu******** ***********@new sfe3-win.ntli.net...
In a previous thread, I was asking about setting up my global.aspx which
inherits System.Web.Http Application. This is where there are the event
handlers like:

Sub Session_Start(B yVal sender As Object, ByVal e As EventArgs)
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)

In this file I've got:

Private WithEvents ApplicationTime r As System.Timers.T imer ' used to
generate application events

and the associated:

Private Sub ApplicationTime r_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.E lapsedEventArgs ) Handles ApplicationTime r.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_unforget table.comwrote in message
news:zu******** ***********@new sfe3-win.ntli.net...
In a previous thread, I was asking about setting up my global.aspx which
inherits System.Web.Http Application. This is where there are the event
handlers like:

Sub Session_Start(B yVal sender As Object, ByVal e As EventArgs)
Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)

In this file I've got:

Private WithEvents ApplicationTime r As System.Timers.T imer ' used to
generate application events

and the associated:

Private Sub ApplicationTime r_Elapsed(ByVal sender As Object, ByVal e As
System.Timers.E lapsedEventArgs ) Handles ApplicationTime r.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
1658
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 that delivers a lot of the common functionality that .NET developers need. Things like generating DataSets to call against databases, generating code for Windows and Web Forms, deploying the applications and so on. He's nervous that we're going...
6
39154
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 create the procedure then take a look at it through em, it only shows the code up until the word "GO". Example: CREATE PROCEDURE mytest as create table mytable col1 varchar(5), col2 varchar(10)
6
27768
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 difference :-( Suggestions? THX, Harry
7
947
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 news:<40455261$1@usenet.per.paradox.net.au>... > "John Carson" <donaldquixote@datafast.net.au> wrote in message > news:40455214$1@usenet.per.paradox.net.au
1
5803
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 'CVI_GetFileSize' previous declared at utility.h:249" The error stems from Winbase.h, which is included in Windows.h. The relevant lines in Winbase.h is:
3
2121
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 "WaitSleepJoin" when it runs because the function it calls - "GenerateEvents()" has "Sleep()" function. Can I solve this problem with Thread? I don't want add nasty boll flags on it.
1
1917
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 sleep, unpickle... Any thoughts?
5
5928
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 installed it and began learning how to use it. I built several small C# test apps that use common classes in a dll that I also wrote. When I right click on a class that was defined in the dll and select "go to definition" it would open the source...
2
1681
by: Lou | last post by:
How can I add a delay in my code. I used to use "Sleep" in VB6 -Lou
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9023
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7531
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4100
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 we have to send another system
3
2910
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.