1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using System.Web;
- using System.Web.Mvc;
- using System.Web.Routing;
- using System.Web.Http;
- using SysBaseLibs;
- namespace Gs.DataPush.WebApi
- {
- public class Global : HttpApplication
- {
- void Application_Start(object sender, EventArgs e)
- {
- // 在应用程序启动时运行的代码
- AreaRegistration.RegisterAllAreas();
- GlobalConfiguration.Configure(WebApiConfig.Register);
- RouteConfig.RegisterRoutes(RouteTable.Routes);
- log4net.Config.XmlConfigurator.Configure();
- string lcVpath = AppDomain.CurrentDomain.BaseDirectory;
- SysSecLibs.FileFuns.AddSeachingFolder(lcVpath + "Bin");
- this.LogInfo("Application_Start -- System Begin Start!");
- }
- protected void Application_End(object sender, EventArgs e)
- {
- // 在应用程序关闭时运行的代码
- this.LogInfo("Application_End -- System End!");
- }
- protected void Application_Error(object sender, EventArgs e)
- {
- // 在出现未处理的错误时运行的代码
- //获取到HttpUnhandledException异常,这个异常包含一个实际出现的异常
- Exception ex = Server.GetLastError();
- //实际发生的异常
- Exception innerException = ex.InnerException;
- if (innerException != null) ex = innerException;
- this.LogFatal(ex);
- }
- protected void Session_Start(object sender, EventArgs e)
- {
- // 在新会话启动时运行的代码
- this.LogInfo("Session_Start");
- }
- protected void Session_End(object sender, EventArgs e)
- {
- // 在会话结束时运行的代码。
- // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为 InProc 时,才会引发 Session_End 事件。
- // 如果会话模式设置为 StateServer
- // 或 SQLServer,则不会引发该事件。
- this.LogInfo("Session_End");
- }
- }
- }
|