protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DisplayConfig.RegisterDisplayModes(DisplayModeProvider.Instance.Modes); ModelBinderConfig.RegisterModelBinders(ModelBinders.Binders); // Set the application's start date for easy reference ApplicationStartDate = DateTime.Now; }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DisplayConfig.RegisterDisplayModes(DisplayModeProvider.Instance.Modes); ModelBinderConfig.RegisterModelBinders(ModelBinders.Binders); // Set the application's start date for easy reference ApplicationStartDate = DateTime.Now; #region Serilog // ** NOTE: DO NOT ENABLE UNTIL YOU CHANGE THE COMPANY BELOW.. // EXAMPLE: .Enrich.WithProperty("App", "Company.Backoffice") // should change to... // .Enrich.WithProperty("App", "ExigoDemo.Backoffice") // ** /* SeriLog */ //var version = this.GetType().Assembly.GetName().Version; //ApplicationLifecycleModule.RequestLoggingLevel = LogEventLevel.Verbose; //ApplicationLifecycleModule.LogPostedFormData = LogPostedFormDataOption.OnlyOnError; //ApplicationLifecycleModule.FormDataLoggingLevel = LogEventLevel.Error; //Log.Logger = new LoggerConfiguration() // .Enrich.WithMachineName() // .Enrich.WithProperty("App", "Company.Backoffice") // .Enrich.WithProperty("Version", $"{version.Major}.{version.Minor}.{version.Build}") // .WriteTo.Seq("https://log.exigo.com") // .CreateLogger(); //Log.Information("Starting up web"); #endregion // SEE CODE ABOVE IN Application_Start FIRST //protected void Application_End() //{ // Log.CloseAndFlush(); //} #region UseDbOrRedisforSessionData //First we determine if we are going to use Redis (client must have purchased redis in azure) or SQL in memory caching. //If SQL than we fire off operation that will check the sql db to ensure that everything is set up to run in memory caching. var sessionCacheProvider = (GlobalSettings.Exigo.UserSession.UseDbSessionCaching) ? new SqlInMemoryCacheProvider(GlobalSettings.Exigo.Api.Sql.ConnectionStrings.SqlReporting) : new RedisCacheProvider(GlobalSettings.Exigo.Caching.RedisConnectionString) as ICacheProvider; CacheConfig.RegisterCache(sessionCacheProvider); #endregion #region Force Report Cache to Refresh if (GlobalSettings.Backoffices.Reports.CommissionReportCacheRefresh.UseTaskToForceReportCacheRefresh) { Common.Services.CommissionReportRefreshTaskService.InitializeCommissionReportRefreshTask(); } #endregion }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DisplayConfig.RegisterDisplayModes(DisplayModeProvider.Instance.Modes); ModelBinderConfig.RegisterModelBinders(ModelBinders.Binders); // Set the application's start date for easy reference ApplicationStartDate = DateTime.Now; #region Serilog var version = this.GetType().Assembly.GetName().Version; SerilogWebClassic.Configure(cfg => cfg.LogAtLevel(LogEventLevel.Verbose)); SerilogWebClassic.Configure(cfg => cfg.EnableFormDataLogging()); Log.Logger = new LoggerConfiguration() .Enrich.WithMachineName() .Enrich.WithProperty("App", Common.GlobalSettings.Exigo.Api.CompanyKey + ".Backoffice") .Enrich.WithProperty("Version", $"{version.Major}.{version.Minor}.{version.Build}") .WriteTo.Seq("https://log.exigo.com") .CreateLogger(); Log.Information("Starting up web"); #endregion #region UseDbOrRedisforSessionData //First we determine if we are going to use Redis (client must have purchased redis in azure) or SQL in memory caching. //If SQL than we fire off operation that will check the sql db to ensure that everything is set up to run in memory caching. var sessionCacheProvider = (GlobalSettings.Exigo.UserSession.UseDbSessionCaching) ? new SqlInMemoryCacheProvider(GlobalSettings.Exigo.Api.Sql.ConnectionStrings.SqlReporting) : new RedisCacheProvider(GlobalSettings.Exigo.Caching.RedisConnectionString) as ICacheProvider; CacheConfig.RegisterCache(sessionCacheProvider); #endregion #region Force Report Cache to Refresh if (GlobalSettings.Backoffices.Reports.CommissionReportCacheRefresh.UseTaskToForceReportCacheRefresh) { Common.Services.CommissionReportRefreshTaskService.InitializeCommissionReportRefreshTask(); } #endregion ResourceSetManager.Start(new ResourceSetUpdaterOptions { SubscriptionKeys = ConfigurationManager.AppSettings["ResourceSet.SubscriptionKeys"], EnvironmentCode = ConfigurationManager.AppSettings["ResourceSet.EnvironmentCode"], LoginName = ConfigurationManager.AppSettings["Api.LoginName"], Password = ConfigurationManager.AppSettings["Api.Password"], Company = ConfigurationManager.AppSettings["Api.CompanyKey"], LocalPath = Server.MapPath("~/App_Data") }); ViewEngines.Engines.Clear(); //clear all engines ViewEngines.Engines.Add(new RazorViewEngine()); ResourceSetManager.Start(new ResourceSetUpdaterOptions { SubscriptionKeys = ConfigurationManager.AppSettings["ResourceSet.SubscriptionKeys"], EnvironmentCode = ConfigurationManager.AppSettings["ResourceSet.EnvironmentCode"], LoginName = ConfigurationManager.AppSettings["Api.LoginName"], Password = ConfigurationManager.AppSettings["Api.Password"], Company = ConfigurationManager.AppSettings["Api.CompanyKey"], LocalPath = Server.MapPath("~/App_Data") }); }