// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime, IOptions <ServiceSettings> serviceSettings)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            SerilogConfig.Configure(serviceSettings);

            app.UseMvc();
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Warframe Market Aggregator v1");
            });

            app.UseHangfireServer();

            applicationLifetime.ApplicationStarted.Register(() =>
            {
                // Initialize the item cache from a file, if it exists
                // Otherwise, load the items normally
                BackgroundJob.Enqueue <ICacheFileManager>(cacheFileManager => cacheFileManager.RefreshItems(false));

                // Once a day, force a refresh of all items and update the cache file
                RecurringJob.AddOrUpdate <ICacheFileManager>(cacheFileManager => cacheFileManager.RefreshItems(true), Cron.Daily());
            });
        }
示例#2
0
        /// <summary>
        /// The application entry point
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();

            SerilogConfig.Configure(serviceCollection, Configuration);

            try
            {
                Log.Verbose("Starting web host");
                CreateHostBuilder(args).Build().Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, $"Application start-up failed. Error Reason: {ex.Message}");
                throw;
            }
        }
        /// <summary>
        /// The application entry point
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();

            SerilogConfig.Configure(serviceCollection, Configuration);

            RedisConfig.Configure(Configuration);

            try
            {
                Log.Verbose("Starting web host");

                CreateHostBuilder(args).Build().Run();
            }
            catch (Exception ex)
            {
                Log.Error(ex, $"Error creating web host builder: {ex.Message}");
                throw;
            }
        }
示例#4
0
 public override void Configuration(IAppBuilder app)
 {
     base.Configuration(app);
     SerilogConfig.Configure();
 }
示例#5
0
 public static void Main(string[] args)
 {
     SerilogConfig.Configure(Configuration);
     CreateHostBuilder(args).Build().Run();
 }