【问题标题】:Quartz.net scheduler going to standbyQuartz.net 调度程序进入待机状态
【发布时间】:2013-10-12 18:25:38
【问题描述】:

我正在使用我的 asp.net 应用程序中嵌入的石英 .net 服务器,但总是进入待机模式。即使是在 NORMAL 模式下计划的 cron 作业。

这些是我的调度程序属性:

var properties = new NameValueCollection();

        properties["quartz.dataSource.DataSource.connectionString"] = "data source=connectionstring";
        properties["quartz.dataSource.DataSource.provider"] = "SqlServer-20";

        properties["quartz.scheduler.instanceName"] = "MyScheduler";

        properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
        properties["quartz.threadPool.threadCount"] = "5";
        properties["quartz.threadPool.threadPriority"] = "Normal";

        properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
        properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz ";
        properties["quartz.jobStore.tablePrefix"] = "QRTZ_";
        properties["quartz.jobStore.dataSource"] = "DataSource";
        properties["quartz.jobStore.useProperties"] = "true";

        return new StdSchedulerFactory(properties);

如何让它始终运行?我需要将其作为 Windows 服务运行吗?

【问题讨论】:

  • 计划作业每 5 分钟运行一次有意义吗?
  • 我可能是错的,但我的理解是,如果没有用户连接到该网站,则该网站被认为是空闲的,并且该网站是否实际运行代码并不重要。我认为逻辑是,如果网站正在执行一项长时间运行的任务并且用户厌倦了并离开了,那么继续执行该任务是没有意义的。
  • 是的,您是对的,将其构建为服务并远程连接应该更明智。如果您将您的评论作为答案,我会接受。

标签: c# asp.net .net quartz-scheduler quartz.net


【解决方案1】:

将 Quartz.net 调度程序作为 Windows 服务运行似乎是最好的方法。

如果没有用户连接到任何 ASP.net 应用程序,IIS 的默认设置是关闭它们,这意味着您的调度程序不再运行。可以更改这些默认值(请参阅Can you prevent your ASP.NET application from shutting down?),但更好的方法是将调度程序编写为 Windows 服务。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多