1.新建一个项目
2.引入QuartZ/CrystalQuartz
3.访问:http://localhost:50611/CrystalQuartzPanel.axd
4.指定StdSchedulerFactory监控参数 端口和可视化项目的 webconfig 下的provider value 端口保持一直
原有项目代码
#region Scheduler
//StdSchedulerFactory factory = new StdSchedulerFactory();
//IScheduler scheduler = await factory.GetScheduler();
IScheduler scheduler = await ScheduleManager.BuildScheduler();
await scheduler.Start();
#endregion
ScheduleManager类
public class ScheduleManager
{
public async static Task<IScheduler> BuildScheduler()
{
var properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "后台作业监控系统";
// 设置线程池
properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz";
properties["quartz.threadPool.threadCount"] = "5";
properties["quartz.threadPool.threadPriority"] = "Normal";
// 远程输出配置
properties["quartz.scheduler.exporter.type"] = "Quartz.Simpl.RemotingSchedulerExporter, Quartz";
properties["quartz.scheduler.exporter.port"] = "8008";//端口必须和网站新项目端口一致
properties["quartz.scheduler.exporter.bindName"] = "QuartzScheduler";
properties["quartz.scheduler.exporter.channelType"] = "tcp";
var schedulerFactory = new StdSchedulerFactory(properties);
IScheduler _scheduler = await schedulerFactory.GetScheduler();
return _scheduler;
}
}
来源:CSDN
作者:奔跑吧cpu
链接:https://blog.csdn.net/weixin_41181778/article/details/103748067