项目发布到IIS,Global.asax中不执行
在vs中调试,能执行Application_Start() 方法并执行 PollingApproval.StartTask();
发布到IIS,一点动静都没有,感觉没调用
Global.asax 类中:
protected void Application_Start()
{
//log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("~/Web.config")));
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
PollingApproval.StartTask();
}
PollingApproval 类:
public static void StartTask()
{
lock (objlock)
{
int Interval = ConfigurationParameter.intervalSeconds;
timer = new System.Timers.Timer();
timer.Elapsed += new System.Timers.ElapsedEventHandler(SendApvMessage);
timer.Interval = Interval;
timer.Enabled = true;
timer.Start();
}
}