Frage

i run a background thread in Application_Start() in global.asax to use it like windows service but applicaton_end fire when all session is ended in my website

i have a sms Business that work with webservice and i want to have agent in my server that check incoming message like windows service

i increase session timeout to 10 hours but when i close browser application end fired and my thread stop working

i cant change server properties

can i disable application_end to thread keep working?

I apologize to you because of poor english writing

War es hilfreich?

Lösung 3

iis automatically close website application when no session is open in website for disable this you can change idle time in iis or read website link in global.asax (application_end) function to start a new session

Andere Tipps

You should make a separate program that runs as a service or a batch program to do that. Although ASP.NET persists static variables and such between page loads, you shouldn't be using it to run things in the background. There is no guarantee that things will keep running.

If you need something to happen on the user's end when something happens on the server (like a message received (like on facebook), someone responds to a request, or some other event is raised) you need to implement a polling system in javascript on the webpage that the user sees which uses AJAX (look it up...its such an awesome concept) to periodically talk to the server to see if anything happened. That is how Facebook chat works along with most webmail systems to check for new messages. The server doesn't talk to the browser...the browser asks the server if anything happened.

Here is an example of a chat program that uses AJAX: http://www.dynamicajax.com/fr/JSON_AJAX_Web_Chat-.html

It isn't exactly what you are doing, but it demonstrates the concept of trying to check something after the page has been loaded and making the user's browser respond.

Nay be use a .NET version of quartz-scheduler library (http://quartz-scheduler.org/) for defining and triggering a job based on the configuration (cron expresion).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top