|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Calling Application_Start After Worker Process is RecycledIt 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 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 Show quoteHide quote "headware" wrote: > 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 > On Jul 7, 2:22 am, Joy <J***@discussions.microsoft.com> wrote:
Show quoteHide quote > Hi Dave, The thread is sending out emails based on data in a database. We> > 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 > > "headware" wrote: > > 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 initially discussed putting it into a Windows service but the user was opposed to installing a service. Dave 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 Show quoteHide quote "headware" wrote: > On Jul 7, 2:22 am, Joy <J***@discussions.microsoft.com> wrote: > > 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 > > > > "headware" wrote: > > > 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 > > 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 > 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 Show quoteHide quote "headware" wrote: > On Jul 7, 2:22 am, Joy <J***@discussions.microsoft.com> wrote: > > 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 > > > > "headware" wrote: > > > 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 > > 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 > 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" <david.k.l***@gmail.com> a écrit dans le message de groupe de 30d85019-48f9-455b-a68f-06d743fb5***@l35g2000pra.googlegroups.com...discussion : Show quoteHide quote > 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
Show quote
Hide quote
On Jul 8, 8:22 am, "Patrice" <http://scribe-en.blogspot.com/> wrote: Thanks for the reply. We initially decided that a Windows service was> 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" <david.k.l***@gmail.com> a écrit dans le message de groupe de > discussion : > 30d85019-48f9-455b-a68f-06d743fb5***@l35g2000pra.googlegroups.com... > > > 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 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
Other interesting topics
Gridview render control error in content page
Advice required Brwoser and screen width? Server.ScriptTimeout not being observed? Javascript question VB.Net Developer, Houstan TX, Duration: 6months, ONLY Green Card / (1-140 & EAD approved) Problems adding HyperLink controls through code. Control is null on postback? DAL for sharing? The page cannot be found error message |
|||||||||||||||||||||||