Global.asax.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Web;
  5. using System.Web.Http;
  6. using System.Web.Mvc;
  7. using System.Web.Optimization;
  8. using System.Web.Routing;
  9. using Lottomat.Application.Entity.CommonEntity;
  10. using Lottomat.Application.SystemAutoJob;
  11. namespace Lottomat.Application.Admin
  12. {
  13. /// <summary>
  14. /// 应用程序全局设置
  15. /// </summary>
  16. public class MvcApplication : HttpApplication
  17. {
  18. //线程
  19. private static System.Threading.Thread _schedulerThread = null;
  20. /// <summary>
  21. /// 启动应用程序
  22. /// </summary>
  23. protected void Application_Start()
  24. {
  25. AreaRegistration.RegisterAllAreas();
  26. FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
  27. RouteConfig.RegisterRoutes(RouteTable.Routes);
  28. BundleTable.EnableOptimizations = true;
  29. BundleConfig.RegisterBundles(BundleTable.Bundles);
  30. //=============启动定时检测任务=============
  31. //List<TaskList> taskLists = new List<TaskList>
  32. //{
  33. // new TaskList
  34. // {
  35. // Jobs = new ArrayList
  36. // {
  37. // new AutoAddNewestLotteryManager(),
  38. // },
  39. // SleepInterval = 1000
  40. // },
  41. // new TaskList
  42. // {
  43. // Jobs = new ArrayList
  44. // {
  45. // new AutoRemindingTheForthcomingLotteryManager(),
  46. // },
  47. // SleepInterval = 1500
  48. // }
  49. //};
  50. //SchedulerConfiguration config = new SchedulerConfiguration(taskLists);
  51. //Scheduler scheduler = new Scheduler(config);
  52. //System.Threading.ThreadStart myThreadStart = new System.Threading.ThreadStart(scheduler.Start);
  53. //if (_schedulerThread == null)
  54. //{
  55. // _schedulerThread = new System.Threading.Thread(myThreadStart);
  56. //}
  57. //_schedulerThread.IsBackground = true;
  58. //_schedulerThread.Start();
  59. //=============定时检测任务=============
  60. }
  61. /// <summary>
  62. /// 应用程序错误处理
  63. /// </summary>
  64. protected void Application_Error(object sender, EventArgs e)
  65. {
  66. var lastError = Server.GetLastError();
  67. }
  68. }
  69. }