Пример #1
0
        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 + ".ReplicatedSite")
                         .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

            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"),
                UpdateClassFiles = HttpContext.Current.IsDebuggingEnabled
            });
        }
Пример #2
0
        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;
        }
Пример #3
0
        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", "ExigoDemo.ReplicatedSite")
            //     .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
        }