Asp.net 似乎无法使Quartz.Net在VB.Net Web应用程序项目上工作
我完全按照Quartz手册进行操作,但仍然不确定它为什么没有在Global.asax中选择GetDeal.vb(Quartz作业)。它从未进入\u调度程序。JobGroupNames 和\u scheduler.TriggerGroupNames循环如下:Asp.net 似乎无法使Quartz.Net在VB.Net Web应用程序项目上工作,asp.net,vb.net,quartz.net,Asp.net,Vb.net,Quartz.net,我完全按照Quartz手册进行操作,但仍然不确定它为什么没有在Global.asax中选择GetDeal.vb(Quartz作业)。它从未进入\u调度程序。JobGroupNames 和\u scheduler.TriggerGroupNames循环如下: Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Dim factory As ISchedulerFactory = New StdSchedu
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim factory As ISchedulerFactory = New StdSchedulerFactory()
_scheduler = factory.GetScheduler()
_scheduler.Start()
If _scheduler.IsStarted Then
Dim jobs As String = ""
Dim jobGroup As String = ""
For Each jobGroup In _scheduler.JobGroupNames
Dim jobName As String
For Each jobName In _scheduler.GetJobNames(jobGroup)
jobs = jobs + " " + jobName
Next
Next
jobs = ""
For Each jobGroup In _scheduler.TriggerGroupNames
Dim jobName As String
For Each jobName In _scheduler.GetTriggerNames(jobGroup)
jobs = jobs + " " + jobName
Next
Next
End If
End Sub
我在这里附加了一个下载我的项目的链接。关于如何让它工作有什么建议吗?
-以这种方式更改作业的名称空间:
名称空间作业
这是完整的文件:
Imports Quartz
' Namespace YouMeCoupon.Jobs
Namespace Jobs
Public Class GetDeal : Implements Quartz.IJob
Public Sub Execute(ByVal context As Quartz.JobExecutionContext) Implements Quartz.IJob.Execute
Dim data As JobDataMap = context.MergedJobDataMap
'Dim url As String = data.GetString("URL")
Try
Dim a As String
a = "testing"
Catch ex As Exception
End Try
End Sub
End Class
End Namespace
我建议您使用日志系统来调试Quartz.net。
你必须有这些参考资料:
Common.Logging.dll
Common.Logging.NLog.dll
NLog.dll
然后可以为NLog添加一个配置文件(NLog.config)
并更改web.config,添加以下部分:
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/>
</sectionGroup>
及
.
还请检查Quartz.net版本。在我看来,你没有使用最后一个:1.3 将名称空间从YoumeGroupon.Jobs更改为Jobs完成了此任务。你,LeftyX先生,太棒了!感谢您向我展示如何进行日志记录。在此之前,我不知道如何写入日志。:)日志记录非常重要。我就是这样发现你的问题的;-)
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/>
</sectionGroup>
<common>
<logging>
<factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog">
<arg key="configType" value="FILE" />
<arg key="configFile" value="~/NLog.config" />
</factoryAdapter>
</logging>
</common>