0

可能重复:
Quartz.Net 调度程序在本地工作,但不在远程主机上

当我使用此代码时:

工作代码:

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 触发,但触发器不触发?谢谢。

4

1 回答 1

1

我相信这是Quartz.Net 调度程序在本地工作但不在远程主机上的副本。因此,请使用对您的调度程序工厂的全局引用,并注意应用程序池回收。

于 2012-11-08T05:52:57.263 回答