Calling Application_Start After Worker Process is Recycled


H

headware

It appears that if the worker process is recycled by IIS, that
Application_Start is not called again until the next request comes in.
Is there any way to get this to happen automatically right after the
process is recycled without relying on a request from a user?

The basic story behind this is that we have a thread that is created
in Application_Start and it's supposed to run constantly over the life
of the application. The user does not want to set up the app pool so
that the worker process is never recycled. Is there any way around
this? We could create some kind of dummy client that requests a page
from the app every so often but I was hoping that there would be a
more elegant solution.

Thanks,
Dave
 
Ad

Advertisements

J

Joy

Hi Dave,

Could you elaborate on "what this Thread is doing"?

The basic premise is that if you want to have a Thread that is always
running then why not to host it in a Windows Service.

Why do you need to have a Thread (that is always running) hosted in IIS?

regards,
Joy
 
H

headware

Hi Dave,

Could you elaborate on "what this Thread is doing"?

The basic premise is that if you want to have a Thread that is always
running then why not to host it in a Windows Service.

Why do you need to have a Thread (that is always running) hosted in IIS?

regards,
Joy

The thread is sending out emails based on data in a database. We
initially discussed putting it into a Windows service but the user was
opposed to installing a service.

Dave
 
J

Joy

Hi Dave,

1. You can have a Timer based Windows Service, that checks for data/specific
condition and then sends mails.
2. Else you can have a Timer based Windows service acting as client that
would call a Web Service which eventually will send mails.

According to me Windows Service is apt for your case.

Even if you were to write a dummy client, you will still need to make sure
that it is running always -> which essentially means you wanna a service that
would run without user interaction and un-attended.

regards,
Joy
 
J

Joy

Hi Dave,

1. You can have a Timer based Windows Service, that checks for data/specific
condition and then sends mails.
2. Else you can have a Timer based Windows service acting as client that
would call a Web Service which eventually will send mails. This makes more
sense because in this approach you get to harness the Best of both worlds i.e
having the Web service hosted in IIS, you are letting the IIS take care of
Memory management (depeneding on your setting of App Pool), security etc and
having a Timer based client in Windows Service makes sure that you have the
thread running always.


According to me Windows Service is apt for your case.

Even if you were to write a dummy client, you will still need to make sure
that it is running always -> which essentially means you wanna a service that
would run without user interaction and un-attended.

regards,
Joy
 
P

Patrice

Your solution will likely be the simplest. In some cases you can also
trigger a script based on an event based on perfmon or perhaps on an entry
written in the windows log (try an admin group if you want to give a closer
look at possible options).

Generally I stay away of running something not directly related to the web
site inside my web site. I prefer to use :
- a windows service
- or a scheduled application
- or a SQL Server job
for related background tasks...

--
Patrice

"headware" <[email protected]> a écrit dans le message de groupe de
discussion :
(e-mail address removed)...
 
Ad

Advertisements

H

headware

Your solution will likely be the simplest. In some cases you can also
trigger a script based on an event based on perfmon or perhaps on an entry
written in the windows log (try an admin group if you want to give a closer
look at possible options).

Generally I stay away of running something not directly related to the web
site inside my web site. I prefer to use :
- a windows service
- or a scheduled application
- or a SQL Server job
for related background tasks...

--
Patrice

"headware" <[email protected]> a écrit dans le message de groupe de
discussion :
(e-mail address removed)...

Thanks for the reply. We initially decided that a Windows service was
not going to work because client didn't want one installed on their
server. Otherwise, that's the solution we would have gone with from
the beginning. I was hoping there would be some way to configure IIS
or ASP.NET to wake the process back up immediately after it was
recycled but I'm not hearing anybody say that.

Dave
 

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

Top