zoukankan      html  css  js  c++  java
  • Quartz.Net1.0.2.3 配置记录

    1. 引用quartz.dll和Common.Logging.dll

    2. Web.Config中<configSections>节点下加入

    <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.2.3,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

    3. <appSettings>节点中加入

    <add key="rbac_cronExpr" value="0 0/1 * * * ?"/> 注:每1分钟循环一次

    4. configuration节点下加入

    1 <quartz>
    2         <add key="quartz.scheduler.instanceName" value="ExampleDefaultQuartzScheduler"/>
    3         <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz"/>
    4         <add key="quartz.threadPool.threadCount" value="1"/>
    5         <add key="quartz.threadPool.threadPriority" value="2"/>
    6         <add key="quartz.jobStore.misfireThreshold" value="60000"/>
    7         <add key="quartz.jobStore.type" value="Quartz.Simpl.RAMJobStore, Quartz"/>
    8     </quartz>

    5. 全局Global.asax文件中加入

     1 private IScheduler rbac_sched;
     2 protected void Application_Start(object sender, EventArgs e)
     3 {
     4             
     5     ISchedulerFactory RBACExport_Job = new Quartz.Impl.StdSchedulerFactory();
     6     rbac_sched = RBACExport_Job.GetScheduler();
     7     //Type t = Type.GetType("Sample2.App_Code.TestQuartzJob");
     8     JobDetail rbac_job = new JobDetail("rbac_job", "rbac_group", typeof(Sample2.App_Code.TestQuartzJob));
     9     string rbac_cronExpr = ConfigurationManager.AppSettings["rbac_cronExpr"];
    10     CronTrigger rbac_trigger = new CronTrigger("rbac_trigger", "rbac_group", "rbac_job", "rbac_group", rbac_cronExpr);
    11     rbac_sched.AddJob(rbac_job, true);
    12     DateTime rbac_ft = rbac_sched.ScheduleJob(rbac_trigger);
    13     rbac_sched.Start();
    14 }
    15 
    16 protected void Application_End(object sender, EventArgs e)
    17         {
    18             //在应用程序关闭时运行的代码
    19             if (rbac_sched != null)
    20             {
    21                 rbac_sched.Shutdown(true);
    22             }
    23         }
    24             
    View Code
  • 相关阅读:
    open()函数与读写文件
    vim编辑器常用操作
    strip()函数---去除字符串首尾字符
    Python中字符串转义的用法
    shell中内置字段的分隔符IFS
    shell中整数变量自增用法
    shell中EOF的用法
    shell变量字符串截取
    shell中的“数组”
    年终总结:想的多了就该敷衍性得记录一下
  • 原文地址:https://www.cnblogs.com/kkwoo/p/3781010.html
Copyright © 2011-2022 走看看