private void ScheduledEventWorkCallback(object sender) { try { if (ScheduleConfigs.GetConfig().Enabled) { EventManager.Execute(); } } catch { EventLogs.WriteFailedLog("Failed ScheduledEventCallBack"); } }
private void ScheduledEventWorkCallback(object sender) { try { if (ScheduleConfigs.GetConfig().Enabled) { EventManager.Execute(); } } catch (Exception ex) { EventLogs.WriteFailedLog("Failed ScheduledEventCallBack," + ex.Source + "," + ex.Data + "," + ex); } }
public void Application_OnError(Object sender, EventArgs e) { HttpApplication application = (HttpApplication)sender; HttpContext context = application.Context; EventLogs.WriteFailedLog("Discuz.Forum.HttpModule Application_OnError: " + context.Server.GetLastError().Message); ////if (context.Server.GetLastError().GetBaseException() is MyException) //{ // //MyException ex = (MyException) context.Server.GetLastError().GetBaseException(); // context.Response.Write("<html><body style=\"font-size:14px;\">"); // context.Response.Write("Discuz!NT Error:<br />"); // context.Response.Write("<textarea name=\"errormessage\" style=\"width:80%; height:200px; word-break:break-all\">"); // context.Response.Write(System.Web.HttpUtility.HtmlEncode(context.Server.GetLastError().ToString())); // context.Response.Write("</textarea>"); // context.Response.Write("</body></html>"); // context.Response.End(); //} }
/// <summary> /// 实现接口的Init方法 /// </summary> /// <param name="context"></param> public void Init(HttpApplication context) { try { OnlineUsers.ResetOnlineList(); context.BeginRequest += new EventHandler(ReUrl_BeginRequest); if (eventTimer == null && ScheduleConfigs.GetConfig().Enabled) { EventManager.RootPath = AppDomain.CurrentDomain.BaseDirectory; eventTimer = new Timer(new TimerCallback(ScheduledEventWorkCallback), context.Context, 60000, EventManager.TimerMinutesInterval * 60000); } } catch (Exception e) { EventLogs.WriteFailedLog("Discuz.Forum.HttpModule Init:" + e.Message); } }
/// <summary> /// 启动和重置最后更新时间 /// </summary> /// <param name="key">事件key</param> /// <param name="dealerSysNo">经销商编号</param> /// <remarks>2016-5-4 杨浩 创建</remarks> private void StartUpEvent(string key, int dealerSysNo) { if (eventTimer == null) { eventTimer = new Timer((sender) => { try { EventManager.Execute(); } catch { EventLogs.WriteFailedLog("Failed ScheduledEventCallBack"); } }, null, 60000, EventManager.TimerMinutesInterval * 60000); } else { EventManager.UpdateTimeByKeyAndDealerSysNo(key, dealerSysNo); } }