// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IWebHostEnvironment env, IHttpContextAccessor accessor, IRecommendService _recommendService, IAddAllService _addAllService, IDeleteMonthlyLogFiles _deleteMonthlyLogFiles) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseCors(x => x .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseHangfireDashboard(); app.UseHangfireServer(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); RecurringJob.AddOrUpdate(() => _recommendService.ExecuteAsync(), Cron.Daily); RecurringJob.AddOrUpdate(() => _deleteMonthlyLogFiles.Execute(), Cron.Daily); RecurringJob.AddOrUpdate(() => _addAllService.ExecuteAsync(), Cron.Hourly); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); // Enable middleware to serve generated Swagger as a JSON endpoint app.UseSwagger(); // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.) app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); }); app.UseCors("CorsPolicy"); app.UseDeveloperExceptionPage(); }