You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5 KiB

2 years ago
  1. using EasyBL;
  2. using System;
  3. using System.Web;
  4. using System.Web.Http;
  5. using System.Web.Mvc;
  6. using System.Web.Routing;
  7. using System.Web.SessionState;
  8. namespace WebApp
  9. {
  10. public class Global : HttpApplication
  11. {
  12. public override void Init()
  13. {
  14. this.PostAuthenticateRequest += (sender, e) => HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
  15. base.Init();
  16. }
  17. private void Application_Start(object sender, EventArgs e)
  18. {
  19. // Code that runs on application startup
  20. AreaRegistration.RegisterAllAreas();
  21. WebApiConfig.Register(GlobalConfiguration.Configuration);
  22. FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
  23. RouteConfig.RegisterRoutes(RouteTable.Routes);
  24. string LogWorkDir = System.Web.Hosting.HostingEnvironment.MapPath("~/");
  25. LogHelper.Init(LogWorkDir, System.IO.Path.Combine(LogWorkDir, "Log4Net.config"));
  26. // 启动日志组件
  27. //log4net.Config.XmlConfigurator.Configure();
  28. // 启动索引管理器
  29. //IndexManager.Instance.Start();
  30. // 启动定时任务
  31. //TaskScheduler.Start();
  32. }
  33. private void Application_End(object sender, EventArgs e)
  34. {
  35. // Code that runs on application shutdown
  36. }
  37. private void Application_Error(object sender, EventArgs e)
  38. {
  39. // Code that runs when an unhandled error occurs
  40. }
  41. }
  42. }