コード例 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, Seed seed, ILoggerFactory loggerFactory, BlockchainService blockchainService)
        {
            app.UseCustomExceptionHandler(this._logger);
            app.UseHangfireServer();
            app.UseHangfireDashboard();

            app.Map("/error", x => x.Run(y => throw new Exception()));
            loggerFactory.AddProvider(new ConsoleLoggerProvider((category, logLevel) => logLevel >= LogLevel.Critical, false));
            loggerFactory.AddConsole();

            this._logger = loggerFactory.CreateLogger <ConsoleLogger>();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                if (!seed.ProposalPaymentsHasData())
                {
                    seed.ProposalPayments();
                }
            }
            else
            {
                // app.UseHsts();
            }

            RecurringJob.AddOrUpdate(() => blockchainService.SaveBlockchainData(), "*/5 * * * *");

            app.UseCors("AllowAll");

            // Enforce Authentication configuration (jwt)
            app.UseDefaultFiles();
            app.UseStaticFiles();
            app.UseAuthentication();
            // app.UseHttpsRedirection();
            app.UseMvc();
        }