using SysBaseLibs; using SysSecLibs; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Http; using System.Web.Mvc; using System.Web.Routing; using System.Web.Security; using System.Web.SessionState; using DataTransfersLibs; namespace GSMarketSys { public class Global : HttpApplication { void Application_Start(object sender, EventArgs e) { // 在应用程序启动时运行的代码 AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); AutoMapConfiguration.Configure(); string lcVpath = AppDomain.CurrentDomain.BaseDirectory; SysSecLibs.FileFuns.AddSeachingFolder(lcVpath + "Bin"); SysBaseLibs.ThreadLog.LogBlank(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); SysBaseLibs.ThreadLog.LogInfo("Application_Start -- System Begin Start!"); // 重要商品来源数据抓取 //MajorGoodsSourcePuller.Instance.Start(); } void global_asax_EndRequest(object sender, EventArgs e) { SysBaseLibs.ThreadLog.LogInfo(this.ToString() + " global_asax_EndRequest sender:" + sender.ToString() + " e: " + e.ToString()); } void global_asax_Error(object sender, EventArgs e) { SysBaseLibs.ThreadLog.LogInfo(this.ToString() + " global_asax_Error sender:" + sender.ToString() + " e: " + e.ToString()); } void global_asax_Disposed(object sender, EventArgs e) { SysBaseLibs.ThreadLog.LogInfo(this.ToString() + " global_asax_Disposed sender:" + sender.ToString() + " e: " + e.ToString()); } void Application_End(object sender, EventArgs e) { // 在应用程序关闭时运行的代码 SysBaseLibs.ThreadLog.LogInfo(" Application_End -- System End!"); // 重要商品来源数据抓取 //MajorGoodsSourcePuller.Instance.Stop(); } void Application_Error(object sender, EventArgs e) { // 在出现未处理的错误时运行的代码 Exception ex = Server.GetLastError(); //实际发生的异常 Exception innerException = ex.InnerException; if (innerException != null) ex = innerException; SysBaseLibs.ThreadLog.LogErr("Application_Error: " + ex); SysBaseLibs.ThreadLog.LogErr("Application_Error: "+this.Session.Contents.SessionID); } void Session_Start(object sender, EventArgs e) { // 在新会话启动时运行的代码; SysBaseLibs.ThreadLog.LogInfo("Session_Start"); } void Session_End(object sender, EventArgs e) { // 在会话结束时运行的代码。 // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为 // InProc 时,才会引发 Session_End 事件。如果会话模式设置为 StateServer // 或 SQLServer,则不会引发该事件。 SysDataLibs.UserSession loSession = SysDataLibs.WebLibs.GetUserSession(); if (loSession != null) { SysBaseLibs.ThreadLog.LogInfo(loSession.UserInfo.UserID + "logout"); SysDataLibs.TableClass.Sys_Log_info.LogMsg(SysDataLibs.TableClass.LogType.System, "LoginOut", loSession.UserInfo.UserID, ""); loSession.Destroy(); loSession = null; } SysBaseLibs.ThreadLog.LogInfo("Session_End"); } } }