我有一个非常简单的时间表和一份使用Quartz的工作,当我不使用nancyfx并且在我的global.asax中有MySchedule.Start()
时它工作正常。我在使用nancyfx和bootstrapper.cs一个独立的MVC项目试过同样的工作,同样的时间表,我不知道跑哪里去了MySchedule.Start()
在Nancyfx项目中使用Quartz。没有global.asax开始时间表?
我试了一下引导程序内,并没有工作:
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ApplicationStartup(Nancy.TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
MySchedule.Start();
}
}
为什么在NancyFX中使用ASP.NET MVC? Nancy已经是C#应用程序的API层。我更喜欢创建一个控制台应用程序,在main中使用topshelf,并在服务启动时同时启动nancy(self host)和quartz作业。 – skynyrd