Need job scheduler in asp.net

后端 未结 9 2270
無奈伤痛
無奈伤痛 2021-02-03 14:01

We have a website where we need a scheduler to receive notifications (e-mail) on specific time. eg. a person setting reminder at 5 PM to attend the meeting at 4:45 PM, will rece

9条回答
  •  Happy的楠姐
    2021-02-03 14:56

    However if you really are completely stuck and have no choice but to host it in your WebApp,

    You could look at creating a System.Timers.Timer instance in your Global.asax.cs file. Wire up a Elapsed event as you normally would, and give it some code that does something along the lines of

    protected void myTimer_Elapsed(object sender, EventArgs e)
    {
        if(System.DateTime.Now Falls in Some Configured Time-Window)
            //Do Stuff
    }
    

    But as someone pointed out, its not guaranteed as IIS might be resetting during that period, in which case you'll miss it.

提交回复
热议问题