2011-12-26 2 views
1

Я Взглянув на 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 Client Profile ...

Но когда он работает, код на первой линии бросков:

Инициализатор типа для «Quartz.Impl.StdSchedulerFactory» выбрал исключение .

Я ничего не могу с этим поделать, у кого есть идеи?

+0

Что такое InnerException? – SLaks

+0

его Common Logging.dll, когда я смотрю на InnerException, он говорит, что assenbly не находит, поэтому я добавил его в свой проект. – RickardP

ответ

3

Если вы добавили Quartz в свой проект с помощью Copy local, убедитесь, что Common.Logging.dll присутствует в том же каталоге, что и сборка Quartz.

Не уверен, что это имеет какое-либо отношение к профилю клиента, но попробуйте его в любом случае с полным фреймворком.

+0

его был Common Logging.dll, когда я смотрю на InnerException, он говорит, что assenbly не находит, поэтому я добавил его в свой проект. – RickardP