为Quartz.net类型初始抛出一个异常
问题描述:
我考虑看看Quartz.NET 2.0测试版1为Quartz.net类型初始抛出一个异常
我使用的第一个例子代码,在我自己的项目,我的代码是:
class Program
{
static void Main(string[] args)
{
// First we must get a reference to a scheduler
ISchedulerFactory sf = new StdSchedulerFactory();
IScheduler sched = sf.GetScheduler();
// computer a time that is on the next round minute
DateTimeOffset runTime = DateBuilder.EvenMinuteDate(DateTimeOffset.UtcNow);
// define the job and tie it to our HelloJob class
IJobDetail job = JobBuilder.Create<HelloJob>()
.WithIdentity("job1", "group1")
.Build();
// Trigger the job to run on the next round minute
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.StartAt(runTime)
.Build();
// Tell quartz to schedule the job using our trigger
sched.ScheduleJob(job, trigger);
Console.WriteLine(string.Format("{0} will run at: {1}", job.Key, runTime.ToString("r")));
// Start up the scheduler (nothing can actually run until the
// scheduler has been started)
sched.Start();
// wait long enough so that the scheduler as an opportunity to run the job!
// wait 65 seconds to show jobs
Thread.Sleep(TimeSpan.FromSeconds(65));
// shut down the scheduler
sched.Shutdown(true);
}
}
/// <summary>
/// This is just a simple job that says "Hello" to the world.
/// </summary>
/// <author>Bill Kratzer</author>
/// <author>Marko Lahma (.NET)</author>
public class HelloJob : IJob
{
/// <summary>
/// Empty constructor for job initilization
/// <para>
/// Quartz requires a public empty constructor so that the
/// scheduler can instantiate the class whenever it needs.
/// </para>
/// </summary>
public HelloJob()
{
}
/// <summary>
/// Called by the <see cref="IScheduler" /> when a
/// <see cref="ITrigger" /> fires that is associated with
/// the <see cref="IJob" />.
/// </summary>
public virtual void Execute(IJobExecutionContext context)
{
// Say Hello to the World and display the date/time
Console.WriteLine(string.Format("Hello World! - {0}", System.DateTime.Now.ToString("r")));
}
}
我可以编译经过多次失败的测试与.net Framework Client Profile受这个代码...
但在运行时,在第一行代码抛出:
“Quartz.Impl.StdSchedulerFactory”的类型初始值设定项引发了 异常。
我找不到任何关于此事的信息,有没有人有一些想法?
答
如果使用本地复制将Quartz添加到项目中,请确保Common.Logging.dll与Quartz的程序集位于同一目录中。
不知道这与客户端配置文件有什么关系,但无论如何都要使用完整框架进行尝试。
+0
它是Common Logging.dll,当我看看InnerException时,它说可信地找不到,所以我将它添加到我的项目中。 – RickardP 2011-12-27 07:15:55
什么是InnerException? – SLaks 2011-12-26 21:06:58
它是Common Logging.dll,当我看看InnerException时,它说可能找不到,所以我将它添加到我的项目中。 – RickardP 2011-12-27 07:16:12