可能重复:
Quartz.Net scheduler works locally but not on remote host
当我使用此代码时:
工作代码:
Public Class ImportJob
Implements IJob
Public Sub Execute(context As IJobExecutionContext) Implements IJob.Execute
'''some code
End Sub
End Class
触发代码:
Public Class ScheduleManager
Public Shared Property Scheduler As IScheduler
Public Sub RunTrigger()
Dim startTime As DateTimeOffset
startTime = DateBuilder.DateOf(20, 0, 0)
Dim scheduler = GetScheduler
Dim job As IJobDetail = JobBuilder.Create(Of ImportJob)().WithIdentity("jobname").Build()
Dim trigger As ITrigger
trigger = TriggerBuilder.Create().ForJob(job).WithIdentity("som Name").WithDescription("some Desc").StartAt(startTime).WithSimpleSchedule(Function(x) x.WithIntervalInHours(24).RepeatForever).Build()
scheduler.ScheduleJob(job, trigger)
scheduler.Start()
End Sub
Public ReadOnly Property GetScheduler As IScheduler
Get
If Scheduler Is Nothing Then
Scheduler = New StdSchedulerFactory().GetScheduler()
End If
Return Scheduler
End Get
End Property
End Class
并在全球范围内:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
Dim schde As New ScheduleManager
schde.RunTrigger()
End Sub
我使用此触发器和作业进行调度,当我使用该代码时,触发器必须在20:00触发,但触发器不会触发? 感谢。
答案 0 :(得分:1)
我认为这是Quartz.Net scheduler works locally but not on remote host的副本。因此,请使用对调度程序工厂的全局引用,并了解应用程序池的回收。