日期:2014-05-17 浏览次数:20515 次
protected void Application_Start(object sender, EventArgs e) { if (HttpRuntime.Cache["ScheduleTask"] == null) { //第一种办法 //System.Timers.Timer t = new System.Timers.Timer(); //t.Elapsed+=new System.Timers.ElapsedEventHandler(test); //t.Interval = 1000; //t.Enabled = true; //GC.KeepAlive(t); //第二种办法 System.Threading.Thread thread = new System.Threading.Thread(test); thread.Start(); //HttpRuntime.Cache["ScheduleTask"] = st; } } void test() { Log.writeLog("测试成功"); }
namespace xinchen.Shared.Tools { public class UrlHelper { public static string Root = HttpContext.Current.Request.ApplicationPath; ···············