I have a simple question to ask.. Does anyone know how to create a repetitive scheduler in ASP.NET MVC 4. What I'm attempting to build is an Irrigation System that I can set the days of the week and times for my system to activate each week. So the user would select the Day of the week along with the time and duration the system should run. How do I keep a running clock that triggers the system to turn on?.. Should I use a drop down list for my properties? Although it would be nice, I'm not asking for you to write an entire application for me.. A simple point in the right direction would help tremendously.. The problem with searching for the answers over the net is I really don't know what to search for.
我有一个简单的问题要问..有没有人知道如何在ASP.NET MVC 4中创建重复的调度程序。我正在尝试构建的是一个灌溉系统,我可以设置我的系统的星期几和时间每周激活。因此,用户将选择星期几以及系统应运行的时间和持续时间。如何保持一个运行时钟触发系统打开?我应该使用下拉列表来查找我的属性吗?虽然它会很好,但我并没有要求你为我编写一个完整的应用程序..正确方向的一个简单点将有很大的帮助..通过网络搜索答案的问题是我真的不知道要搜索什么。
Thank you in advance..
先谢谢你..
4 个解决方案
#1
9
We are using Quartz.Net exactly for this. It is a port of Quartz for Java.
我们正在使用Quartz.Net。它是Quartz for Java的一个端口。
It is very powerful and it is quite easy to define new jobs (what should be done) and schedules (when to do it). The new versions support a Cron scheduler which supports linux cron like configuration - so it is quite easy to start a job on every monday, or on every 5th of the month or for every 5 minutes on a given date. I think it's hard for scheduled tasks to beat this flexibility.
它非常强大,很容易定义新的工作(应该做什么)和时间表(何时做)。新版本支持一个支持Linux cron配置的Cron调度程序 - 因此很容易在每个星期一,或每月的每个5或在给定日期每5分钟开始一个工作。我认为计划任务很难超越这种灵活性。
We are using the database configuration and a service on the server (this is the "running clock which activates things). Additionally a web services is used to configure the Quartz scheduler and the running service is changed through the database (this is done by Quartz.Net for you). All these things are supported nicely with it.
我们正在使用数据库配置和服务器上的服务(这是“运行时钟来激活事物”。另外,Web服务用于配置Quartz调度程序,并且正在运行的服务通过数据库进行更改(这由Quartz完成) .Net for you。)所有这些都得到了很好的支持。
Some tips to start with cron triggers:
一些从cron触发器开始的提示:
First thing would be the tutorial from http://quartznet.sourceforge.net/tutorial/lesson_1.html . Lessons 1 - 3 show you the basic building blocks. Lesson 9 shows you the ADO job store (for db persistance).
首先是来自http://quartznet.sourceforge.net/tutorial/lesson_1.html的教程。第1 - 3课向您展示了基本的构建模块。第9课显示ADO作业存储(对于db persistance)。
Working with the cron trigger would work like this
使用cron触发器可以像这样工作
ITrigger trigger = TriggerBuilder.Create().WithIdentity(id).StartNow().WithCronSchedule(cronstring).Build();
scheduler.ScheduleJob(job, trigger);
To give you an idea of the possibilites of the cron trigger this guide comes handy.
为了让您了解cron触发器的可能性,本指南非常方便。
#2
5
Follow this link:
点击此链接:
http://scheduler-net.com/docs/simple_.net_application_with_scheduler.html
http://scheduler-net.com/docs/simple_.net_application_with_scheduler.html
http://blog.scheduler-net.com/post/2012/10/29/5-Steps-to-a-Simple-Scheduler-in-ASPNET-MVC3MVC4.aspx
http://blog.scheduler-net.com/post/2012/10/29/5-Steps-to-a-Simple-Scheduler-in-ASPNET-MVC3MVC4.aspx
Scheduler for Web application ASP.NET MVC
Web应用程序ASP.NET MVC的调度程序
#3
3
Friend, you can create a scheduler with the help of following code
朋友,您可以借助以下代码创建调度程序
void Application_Start(object sender, EventArgs e)
{
System.Threading.Timer _timer = new System.Threading.Timer(
new TimerCallback(GetProducts));
_timer.Change(0, 51000); // here you can change the start time interval
}
static void GetProducts(Object state)
{
// do something
}
#4
2
To make scheduled tasks on an independent date time server, and get detailed reports about all tasks, you can use A Trigger as a scheduling service. abilities such as pause, resume or delete sets of tasks using tags, archiving and storing all call results such as possible errors will really help developers independent of the programming language.
要在独立日期时间服务器上执行计划任务,并获取有关所有任务的详细报告,可以使用A Trigger作为计划服务。使用标签暂停,恢复或删除任务集,存档和存储所有调用结果(如可能的错误)等功能将真正帮助开发人员独立于编程语言。
.Net library is also available:
.Net库也可用:
//Create
ATrigger.Client.doCreate(TimeQuantity.Day(), "1", "http://www.example.com/myTask?something", tags);
Disclaimer: I was amoung ATrigger builders. It's an absolutely freeware, not commercial purpose.
免责声明:我是ATrigger的建筑商。这绝对是免费软件,不是商业目的。
#1
9
We are using Quartz.Net exactly for this. It is a port of Quartz for Java.
我们正在使用Quartz.Net。它是Quartz for Java的一个端口。
It is very powerful and it is quite easy to define new jobs (what should be done) and schedules (when to do it). The new versions support a Cron scheduler which supports linux cron like configuration - so it is quite easy to start a job on every monday, or on every 5th of the month or for every 5 minutes on a given date. I think it's hard for scheduled tasks to beat this flexibility.
它非常强大,很容易定义新的工作(应该做什么)和时间表(何时做)。新版本支持一个支持Linux cron配置的Cron调度程序 - 因此很容易在每个星期一,或每月的每个5或在给定日期每5分钟开始一个工作。我认为计划任务很难超越这种灵活性。
We are using the database configuration and a service on the server (this is the "running clock which activates things). Additionally a web services is used to configure the Quartz scheduler and the running service is changed through the database (this is done by Quartz.Net for you). All these things are supported nicely with it.
我们正在使用数据库配置和服务器上的服务(这是“运行时钟来激活事物”。另外,Web服务用于配置Quartz调度程序,并且正在运行的服务通过数据库进行更改(这由Quartz完成) .Net for you。)所有这些都得到了很好的支持。
Some tips to start with cron triggers:
一些从cron触发器开始的提示:
First thing would be the tutorial from http://quartznet.sourceforge.net/tutorial/lesson_1.html . Lessons 1 - 3 show you the basic building blocks. Lesson 9 shows you the ADO job store (for db persistance).
首先是来自http://quartznet.sourceforge.net/tutorial/lesson_1.html的教程。第1 - 3课向您展示了基本的构建模块。第9课显示ADO作业存储(对于db persistance)。
Working with the cron trigger would work like this
使用cron触发器可以像这样工作
ITrigger trigger = TriggerBuilder.Create().WithIdentity(id).StartNow().WithCronSchedule(cronstring).Build();
scheduler.ScheduleJob(job, trigger);
To give you an idea of the possibilites of the cron trigger this guide comes handy.
为了让您了解cron触发器的可能性,本指南非常方便。
#2
5
Follow this link:
点击此链接:
http://scheduler-net.com/docs/simple_.net_application_with_scheduler.html
http://scheduler-net.com/docs/simple_.net_application_with_scheduler.html
http://blog.scheduler-net.com/post/2012/10/29/5-Steps-to-a-Simple-Scheduler-in-ASPNET-MVC3MVC4.aspx
http://blog.scheduler-net.com/post/2012/10/29/5-Steps-to-a-Simple-Scheduler-in-ASPNET-MVC3MVC4.aspx
Scheduler for Web application ASP.NET MVC
Web应用程序ASP.NET MVC的调度程序
#3
3
Friend, you can create a scheduler with the help of following code
朋友,您可以借助以下代码创建调度程序
void Application_Start(object sender, EventArgs e)
{
System.Threading.Timer _timer = new System.Threading.Timer(
new TimerCallback(GetProducts));
_timer.Change(0, 51000); // here you can change the start time interval
}
static void GetProducts(Object state)
{
// do something
}
#4
2
To make scheduled tasks on an independent date time server, and get detailed reports about all tasks, you can use A Trigger as a scheduling service. abilities such as pause, resume or delete sets of tasks using tags, archiving and storing all call results such as possible errors will really help developers independent of the programming language.
要在独立日期时间服务器上执行计划任务,并获取有关所有任务的详细报告,可以使用A Trigger作为计划服务。使用标签暂停,恢复或删除任务集,存档和存储所有调用结果(如可能的错误)等功能将真正帮助开发人员独立于编程语言。
.Net library is also available:
.Net库也可用:
//Create
ATrigger.Client.doCreate(TimeQuantity.Day(), "1", "http://www.example.com/myTask?something", tags);
Disclaimer: I was amoung ATrigger builders. It's an absolutely freeware, not commercial purpose.
免责声明:我是ATrigger的建筑商。这绝对是免费软件,不是商业目的。