Beispiel #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, ILoggerFactory loggerFactory, ScheduledTasks tasks)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseCors(builder => builder
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials());

            app.UseFileServer(new FileServerOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(Directory.GetCurrentDirectory(), @"StaticDocuments")),
                RequestPath             = new PathString("/Documents"),
                EnableDirectoryBrowsing = true
            });

            app.UseHangfireServer();
            app.UseHangfireDashboard();

            app.UseAuthentication();
            app.UseDefaultFiles();
            app.UseStaticFiles();

            RecurringJob.AddOrUpdate(() => tasks.Daily_SpreadsheetBackup(), "0 7  * * *");      //Runs Daily At Midnight local (7am utc)
            RecurringJob.AddOrUpdate(() => tasks.Daily_CleanupStaticDocuments(), "0 8  * * *"); //Runs Daily At 1am local ( 8am utc)
            app.UseMvc();
        }