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