Running an App in the background

T

Toby

How do i create an ASP.NET application which executes in
the background regardless of who is connected to the web
server? For instance, i want to send an email out to a
list of users based on a timer. Thnx
 
K

Kevin Spencer

It all depends on your situation. The most efficient way to do what you're
describing would be to not write an ASP.Net app to do it, but a Service. The
reason? ASP.Net is a technology designed to work within the HTTP environment
of a web server, and has all the overhead necessary to do so. However, the
requirement you've defined has nothing to do with HTTP, Request and
Response, or HTML. It is an app that periodically sends email. The Service
model perfectly fits the description.

If, however, for some reason you don't have the means to write a Service to
do this, it couold be done by instantiating a class in the ASP.Net
Application cache which would carry this out. It could be created in the
Application_Start Event Handler of the Global.asax. The only possible
problem would arise if there was a significant time gap in Requests coming
to the web server, in which case the Application would die, and of course,
the class with it. The class would be re-instantiated with the first
Request, and continue to operate on the timer. However, for the duration of
the time during which there were no requests, there would be no emails sent.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

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,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top