zoukankan      html  css  js  c++  java
  • 主攻ASP.NET.3.5.MVC3.0架构之重生:MVC在Global.asax.定义定时处理程序

            protected void Application_Start()
            {
                AreaRegistration.RegisterAllAreas();
    
                RegisterRoutes(RouteTable.Routes);
                //RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
    
                ///这里是定义定时处理程序,时间1秒钟,可以讲1000改大一些
                int time = ((1000 * 60) * 60) * 10;
                //int time = 1000;
                System.Timers.Timer aibidTimer = new System.Timers.Timer(time);
                aibidTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);
                aibidTimer.Interval = time;
                aibidTimer.Enabled = true;
                aibidTimer.AutoReset = true;
    
            }
            ArticleCategoryRepository categoryrepository = new ArticleCategoryRepository();
            private void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
            {
    
                ///这里定义要处理的逻辑
                
            }

    Global.asax.cs
     

  • 相关阅读:
    Python操作 RabbitMQ、Redis、Memcache、SQLAlchemy
    Django的ORM操作
    RabbitMQ
    CentOS忘记用户名或者密码解决办法
    VUE-es6
    vue基础之命令
    爬虫框架:scrapy
    爬虫高性能相关
    MongoDB
    Beautifulsoup模块
  • 原文地址:https://www.cnblogs.com/cube/p/2879395.html
Copyright © 2011-2022 走看看