換工作的命名空間是這樣的:Namespace Jobs
這是一個完整的文件:
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)
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<targets>
<target name="DebugHandler" type="File" filename="${basedir}/_Logs/${date:format=yyyyMMdd}_${level}.Log"
layout="${longdate} ${logger} ${aspnet-session:variable=UserName} ${threadid} ${environment} ${identity} ${aspnet-request} ${message} ${exception}" />
<target name="ErrorHandler" type="File" filename="${basedir}/_Logs/${date:format=yyyyMMdd}_${level}.Log"
layout="${longdate} ${logger} ${aspnet-session:variable=UserName} ${threadid} ${environment} ${aspnet-request} ${message} ${exception}" />
<target name="FatalHandler" type="File" filename="${basedir}/_Logs/${date:format=yyyyMMdd}_${level}.Log"
layout="${longdate} ${logger} ${aspnet-session:variable=UserName} ${threadid} ${environment} ${aspnet-request} ${message} ${exception}" />
<target name="GenericHandler" type="File" filename="${basedir}/_Logs/${date:format=yyyyMMdd}_${level}.Log"
layout="${longdate} ${logger} ${aspnet-session:variable=UserName} ${threadid} ${environment} ${aspnet-request} ${message} ${exception}" />
</targets>
<rules>
<logger name="*" level="Debug" appendTo="DebugHandler" />
<logger name="*" level="Error" appendTo="ErrorHandler" />
<logger name="*" level="Fatal" appendTo="FatalHandler" />
<logger name="*" levels="Info,Warn" appendTo="GenericHandler" />
</rules>
</nlog>
,改變你的web.config中添加以下部分:
<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>
現在,一切都應該追溯到您的_Logs(您必須添加到您的項目中)。你更容易理解發生的事情。
您可以通過日誌記錄here找到更新的解決方案。 也檢查Quartz.net版本。在我看來,你沒有使用最後一個:1.3。
將名稱空間從YouMeCoupon.Jobs更改爲作業完成了這項工作。你,萊夫蒂爵士,真是太棒了!感謝您向我展示如何完成日誌記錄。在此之前,我不知道如何寫入日誌。 :) – 2011-05-29 10:41:31
記錄是非常重要的。這就是我發現你的問題;-) – LeftyX 2011-05-29 12:28:19