We have some long running operation firing when the user does something(generating several reports). We don't want the user to wait till those reports have been generated. Is there a quick way to accomplish this without having to implement a jobscheduler? Maybe using threads like this? Or is this not safe?
    public ActionResult About()
    {
        Thread thread = new Thread(new ThreadStart(MuchWork));
        thread.Start();
        return View();
    }
    public void MuchWork()
    {
        Thread.Sleep(10000);
        Thread.Sleep(4000);
    }
                See the post The Dangers of Implementing Recurring Background Tasks In ASP.NET by Phil Haack where he describes how to hack a psuedo-job scheduler while using the IRegisteredObject interface to limit IIS/AppPool shut-down issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With