1
我在ASP.NET MVC 4项目中使用Fluent Scheduler
。我想创建一个每天凌晨4点运行的调度程序。这里是我的代码:Fluent调度程序只运行一次
服务
public class ParseService : Registry
{
public ParseService(string path)
{
Schedule(() => ParseHelper.ParseData(path)).ToRunEvery(1).Days().At(4, 0);
}
}
的Global.asax.cs
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
Application["LogPath"] = Server.MapPath("~/Areas/Admin/LogFiles/");
TaskManager.Initialize(new ParseService(Application["LogPath"].ToString()));
}
}
的问题是,调度只运行一次。如果我想让它在凌晨4点再次运行,我必须重新启动IIS服务器。有人知道我的代码有什么问题吗?请帮帮我。非常感谢。
感谢您的回答。我赞同你。但是这个库被广泛使用,所以我希望它没有这个错误。你有没有用过它? :( – AnhTriet
@ Forte_201092,有什么错误?没有我没有用过它。 –
调度程序线程如何被回收?如果这个库让这种情况发生,那就很......坏: – AnhTriet