在asp.net MVC中实现调度的最佳方法是什么
我有一个 ASP.NET MVC Web 应用程序,需要安排任务。 (计划了大部分功能)
我使用 Quartz.net 作为我的调度程序,目前将其作为 Windows 服务运行。 通过集群来处理负载并在高峰时段执行资源密集型任务
我面临的问题是能够调度所有必需的功能,我必须将所有内容包含在调度程序服务中,包括所有程序集和大部分mvc 基础(例如,使用 MVC 视图生成电子邮件提醒模板),因此该服务成为 Web 应用程序的复制品,并带有大量附加代码以使其运行良好。这正在成为一场噩梦。
那我可以吗?
1) 配置调度程序以在 asp.Net MVC 中工作。
2) 使用调用所需网页的 Widows 服务。
3 )使用当前的服务设计。
我的偏好可能是#1,因为这将解决上述所有问题,但如果一段时间内没有活动,网络应用程序将被回收/停止,这意味着预定的作业可能不会被执行(仅当周围有一些活动时作业应该运行的时间)。 asp.net 网站中的 Quartz.net 设置
任何想法/关于哪种方法是最好的方法或任何替代方法的建议?
I have an asp.net MVC web application that requires tasks to be scheduled. (A large chunk of functionality is scheduled)
I am using Quartz.net as my scheduler and am currently running it as a windows service. Clustering to handle load and performing resource intensive tasks out of peak hours
The problem I face is to be able to schedule all the required functionality I have to include everything in the scheduler service including all assemblies and most of the mvc base ( e.g using the MVC views to generate email reminder templates ) so the service becomes a duplication of the web application with lots of additional code to make it play nice. This is becoming a bit of a nightmare.
So I can?
1) Configure the scheduler to work within asp.Net MVC.
2) Use a Widows service that calls the required web page.
3) Use current service design.
my preference is probably #1 as this will resolve all of the above issues but the web app will get recycled/stopped if there is no activity for some time, This means that scheduled jobs may not be executed (only if there was some activity around the time when the job should be run).
Quartz.net setup in an asp.net website
Any thoughts/suggestions as to which is the best approach or any alternatives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我肯定会避免选项 1。您的网站应该是请求和响应,仅此而已。
如果您的服务执行的操作不是“长时间运行”并且可以作为 HTTP 请求的请求/响应周期的一部分合理地执行,则选项 2 是合理的。然而,这实际上应该是一个 Web 服务而不是网页调用(这在 OpenRasta 中更容易做到,它不区分网站和 Web 服务)。
如果您计划的操作是密集/长时间运行的,那么它应该在网站之外完成,并且您当前的架构可能没问题。程序集的复制并不是真正的问题(磁盘空间很便宜)。
I would definitely avoid option 1. Your website should be request and response, nothing more.
If the action performed by your service is not 'long running' and can reasonably be performed as part of the request/response cycle of an HTTP request, then option 2 is reasonable. This should really be a web service rather than web page call, however (this is easier to do in OpenRasta which makes no distinction between web sites and web services).
If your scheduled action is intensive/long running then it ought to be done outside the website and your current architecture is probably ok. The replication of assemblies isn't really a problem (disk space is cheap).