当我执行代码之后执行代码时,代码不会在其上执行。它将每天执行一次,但它在我启动我的网站时执行
我在我的代码中使用了cronjob,如果你对线程感到满意
我的代码如下......
在global.asax中的我有这个代码
protected void Application_Start(object sender, EventArgs e)
{
ISchedulerFactory schedFact = new StdSchedulerFactory();
// get a scheduler
IScheduler sched = schedFact.GetScheduler();
sched.Start();
// define the job and tie it to our HelloJob class
IJobDetail job = JobBuilder.Create<HelloJob>()
.WithIdentity("myJob", "group1")
.Build();
// Trigger the job to run now, and then every 40 seconds
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("myTrigger", "group1")
.StartNow()
.WithSimpleSchedule(x => x.WithIntervalInHours(24)
.RepeatForever())
.Build();
sched.ScheduleJob(job, trigger);
// CreatingNewThreadTimer();
}
和hellojob是我要执行的类