Application_Start

J

Joey

asp.net 2/C#

I have noticed that during periods of inactivity on my website, the
Application_Start event is firing about every 40-45 minutes. Is this
normal? Shouldn't the app start once and remain running until I stop
it?

JP
 
I

IfThenElse

Not necessary, some worker processes might be set to recycle, or recycling
for lack of resources or failures.

Check application pool(s)
check World Wide Web Publishing Service
monitor your resources.
 
I

IfThenElse

Check you event logs

IfThenElse said:
Not necessary, some worker processes might be set to recycle, or
recycling for lack of resources or failures.

Check application pool(s)
check World Wide Web Publishing Service
monitor your resources.
 
M

Mark Rae [MVP]

I have noticed that during periods of inactivity on my website, the
Application_Start event is firing about every 40-45 minutes. Is this
normal? Shouldn't the app start once and remain running until I stop
it?

You don't start or stop the Application in this sense...

Application_Start fires when the first Session is created and
Application_End fires when the last Session ends.
 
M

Mark Rae [MVP]

Please define first Session and last Session

When a client browser first sends a Request to a web application running
under IIS, a Session is created...

If no other Sessions are in existence at that moment, Application_Start
fires.

When a Session dies, if no other Sessions are in existence at that moment,
Application_End fires.
 
G

Guest

I believe Application_Start fires even when Session State is disabled. It
fires in response to the first request coming in, not due to "Session".
Also, if an application recycles on its own either due to memory pressure or
IIS settings, Application_End will fire and Application_Start will fire again
when the new appdomain comes up. That behavior would be independent of any
requests.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Joey said:
asp.net 2/C#

I have noticed that during periods of inactivity on my website, the
Application_Start event is firing about every 40-45 minutes. Is this
normal? Shouldn't the app start once and remain running until I stop
it?

JP

It's normal. The web server may stop web applications that aren't active
to preserve resources. The application starts again whenever someone
requests anything from it.
 
A

Andy Fish

if it's unrelated to session, then how would it know when the "last" request
was received?

on my session based application, I'm pretty sure the application_end doesn't
fire when the last session dies. That would mean that if there was only user
logged on at a time, every time they logged out, the appdomain would unload
which would be bad for performance.

I reckon it's much more likely to be worker process idle timeout

that's all an educated guess though - I haven't done any definitive tests

Andy
 
M

Mark Rae [MVP]

I believe Application_Start fires even when Session State is disabled. It
fires in response to the first request coming in, not due to "Session".
Also, if an application recycles on its own either due to memory pressure
or
IIS settings, Application_End will fire and Application_Start will fire
again
when the new appdomain comes up. That behavior would be independent of any
requests.

Yes, I believe that is correct...
 
J

Juan T. Llibre

re:
!> if it's unrelated to session

It *is* unrelated to session...at the end, but not at the beginning.

At the beginning, they're very much related.
For a session to begin to exist, Application_Start *must* have occurred.

re:
!> it's much more likely to be worker process idle timeout

That, or the configured memory/App Pool recycle conditions.
 
I

IfThenElse

Can anyone write a summary of what has been discussed with few example,
scenarios.

How does an HTTPModule deal with Application_start and Application_End
Events.

Thank you,
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Juan said:
re:
!> if it's unrelated to session

It *is* unrelated to session...at the end, but not at the beginning.

At the beginning, they're very much related.
For a session to begin to exist, Application_Start *must* have occurred.

Well, not directly. Before a session can start the application has to
have started, but the application is started to handle the request
rather than because it's needed by the session.
 
G

George Ter-Saakov

I believe that application might start even when there are no pending
requests.
IIS monitors changes or health of the application and if it decided that
something has changed or application deadlocked it will restart it even if
there is no one using it right now. (obviously given that application has
not been active before).

George.
 
J

Juan T. Llibre

re:
!> the application is started to handle the request
!> rather than because it's needed by the session

Even the session is not needed.
However, there will be no sessions without the application.
 
C

Cowboy \(Gregory A. Beamer\)

First, .NET will recycle rarely used processes at times. This is a
conservation method, although you can configure it not to work this way.

Second, you could have the process set to recycle. This can be done in IIS
or config files.

Third, you might have a problem that is causing the recycle. If so, you
should see entries in the event log.
 

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

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top