开发者

Background thread that loads data in asp.net

开发者 https://www.devze.com 2023-02-06 07:03 出处:网络
I want to load data to my application domain using a thread so it will be executed at all times. How can I achieve this? I want the thread will start when iis starts and terminate when iis exits.

I want to load data to my application domain using a thread so it will be executed at all times. How can I achieve this? I want the thread will start when iis starts and terminate when iis exits.

Note: I want to do this so I开发者_开发技巧 can use disconnected architecture in my asp.net application.

Thanks in advance, Kfir


Kfir,

The simplest way to do this is to launch a blocking background-worker during the App_Start() method on Global.asax and then to kill it using App_Stop() in Global.asax.

Have the thread sit on a WaitHandle until it's ready for more data and then signal it to wait back up. Or if you really wanted to code something ghetto, you could just have it poll on a fixed interval using a timer.

0

精彩评论

暂无评论...
验证码 换一张
取 消