在 asp.net 应用程序中使用 Quartz.Net [英] Using Quartz.Net in asp.net application

查看:42
本文介绍了在 asp.net 应用程序中使用 Quartz.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Quartz 调度程序使用 AdoDataStore 作为独立的 Windows 服务在端口 555 中运行.我有一个 asp.net 应用程序,用于为这个调度程序调度作业.我必须在 ASP.NET 端做哪些配置来安排作业?非常感谢任何帮助.

I've the Quartz scheduler uses AdoDataStore running as a stand alone windows service in port 555. I've an asp.net application that schedule jobs for this scheduler. What are the configurations I've to do in the ASP.NET side to schedule jobs? Any help is greatly appreciated.

这是服务配置,

<!-- Configure Thread Pool -->
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />

<!-- Configure Job Store -->
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.StdAdoDelegate, Quartz" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.dataSource.default.connectionString" value="Server=server\MSSQLEXPRESS;Database=QuartzServerDB;Trusted_Connection=True;" />
<add key="quartz.dataSource.default.provider" value="SqlServer-20" />

<!--export this server to remoting context-->
<add key="quartz.scheduler.exporter.type" value="Quartz.Simpl.RemotingSchedulerExporter, Quartz" />
<add key="quartz.scheduler.exporter.port" value="555" />
<add key="quartz.scheduler.exporter.bindName" value="QuartzScheduler" />
<add key="quartz.scheduler.exporter.channelType" value="tcp" />

那么asp.net端的配置如何?

So how would be the configuration in the asp.net side?

推荐答案

我认为答案这里 可能会有所帮助.您可以查看 Quartz.2008 项目中的 Example12.

I think the answer here might help. You can have a look at Example12 in Quartz.2008 project.

你的配置文件必须是这样的:

Your configuration file must be like this:

<!-- Configure Thread Pool -->
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="5" />
<add key="quartz.threadPool.threadPriority" value="Normal" />

<!--Configure remoting expoter-->
<add key="quartz.scheduler.proxy" value="true" />
<add key="quartz.scheduler.proxy.address" value="tcp://localhost:555/QuartzScheduler" />

要记住的一件事:您永远不会启动调度程序.

One thing to remember: you'll never start the scheduler.

由于您在 ASP.NET 中托管 Quartz.net,因此您必须将调度程序定义为单例.

Since you're hosting Quartz.net in ASP.NET you have to define your scheduler as singleton.

这篇关于在 asp.net 应用程序中使用 Quartz.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆