I dont want that application stop

G

Guest

Hi,

I have an asp.net application. And I have worker threads which must run
always (7x24).

I start my threads in Application_Start, and I stop its in Application_Stop
events. I log this events. I see that when all sessions time out, Application
stops. How can prevent application stop?
 
P

Patrice

A (likely bad) way would be to trigger a request on a page of this app on a
regular bais so that you always have someone connected...

Actually it looks like you would need to create a Windows service rather
than a web application. Why should this application always run ?

Patrice
 
G

Guest

Why should this application always run ?
Because it checks some states and if needed it sends email. It must check
every minute.
Actually it looks like you would need to create a Windows service rather
than a web application.
Because manage and maintenance easier than windows service.
A (likely bad) way would be to trigger a request on a page of this app on a
regular bais so that you always have someone connected...
Is not there any likely solution?

Patrice said:
A (likely bad) way would be to trigger a request on a page of this app on a
regular bais so that you always have someone connected...

Actually it looks like you would need to create a Windows service rather
than a web application. Why should this application always run ?

Patrice


--
 
P

Patrice

If you don't want to create a Windows service (AFAIK .NET allows to do that
quite easily) it could be just a regular application that is :
- either scheduled to be lauched every minute
- or is launched one time and wake up itself every minute

I'm not aware of such a settings but perhaps a web.config, machine.config or
IIS setting would allow to keep the web application in memory forever.
The last resort I see would be to issue this HTTP request to itself when
waking up allowing to have the application using itself allowing to keep
running forever...

It could also be triggered by the original source event (for example if this
is caused by data written in a SQL DB, a trigger could then laucn immediatly
the appropriate processing when a new row is added in the table).


Patrice
--

Senol Akbulak said:
Why should this application always run ?
Because it checks some states and if needed it sends email. It must check
every minute.
Actually it looks like you would need to create a Windows service rather
than a web application.
Because manage and maintenance easier than windows service.
A (likely bad) way would be to trigger a request on a page of this app on a
regular bais so that you always have someone connected...
Is not there any likely solution?
 
G

Guest

A long time ago I tried to get an answer to this very same question. It is a
web application that caches many things, so whenever it has to start up from
scratch, it has a few-second delay. This degrades the user experience for
the "first" user who hits the web app after it has been stopped by IIS/.NET.

Unless something has changed in the last year, the only solutions I ever
found were by creating a function within the Global.asax with a timer that
would browser to a self-contained page (that effectively did nothing), except
simply by "hitting" it would keep a session alive, and thus not allow the
application to end.

I don't have an example because I was not able to get it to work.

I will be curious to see if you find a real working solution to this.
 
A

Aquila Deus

Senol said:
Hi,

I have an asp.net application. And I have worker threads which must run
always (7x24).

I start my threads in Application_Start, and I stop its in Application_Stop
events. I log this events. I see that when all sessions time out, Application
stops. How can prevent application stop?

What if you don't stop it in Application_Stop? An ASP.NET webapp is
really stopped only when its application domain is unloaded. Your
worker threads should be able to continue even after the
HttpApplication is stopped.
 
S

Scott Allen

If this is Windows Server 2003, then you can change the "Shutdown
worker process after being idle" time in minutes (or disable the
setting). Go to the IIS MMC -> Computer -> Application Pools and right
click on the pool for your app. The setting is on the performance tab.
 
S

Steven Berkovitz

S

Steven Cheng[MSFT]

Hi Senol,

Have you found a proper solution for this issue? How about Scott's suggest
on using the
"shut down worker process after being idle for ..." setting in the
IIS6(WIN2K3) 's application pool setting's performance tab? When unchecking
that option, we can make the process of that application pool always exist
in memory, not be shutdown after being idle.

In addition , as for the
==================
A (likely bad) way would be to trigger a request on a page of this app on a
regular bais so that you always have someone connected...
==================

I don't think this is a good approach. So if possible, I suggest you
consider the above setting or the Windows service solution other members
have mentioned.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Thank you for your interest.

I am trying Application Pool settings now. I will return when I finish test.
 

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,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top