// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); //app.UseCors( // builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()); app.UseSignalR( routes => { routes.MapHub <ChatHub>("/chat"); }); app.UseAuthentication(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } //app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseSession(); #region InitStaticFiles Images string pathRoot = InitStaticFiles .CreateFolderServer(env, this.Configuration, new string[] { "ImagesPath" }); app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider(pathRoot), RequestPath = new PathString("/" + Configuration.GetValue <string>("ImagesUrl")) }); app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider(pathRoot), RequestPath = new PathString("/" + Configuration.GetValue <string>("ImagesHotelUrl")) }); #endregion ; if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), @"UserImages"))) { Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), @"UserImages")); } app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"UserImages")), RequestPath = new PathString("/UserImages") }); if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), @"Uploaded"))) { Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), @"Uploaded")); } app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), "Uploaded")), RequestPath = "/Uploaded" }); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseReactDevelopmentServer(npmScript: "start"); } }); SeederDB.SeedDataByAS(app.ApplicationServices, env, this.Configuration); SendEmailService.SendInfoStartApp(Configuration, env); }