// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // , IServiceProvider serviceProvider public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler(builder => builder.Run( async context => await x_DOVEHelper.ErrorEventAsync(Configuration, context))); app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseRequestLocalization(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); app.UseAuthorization(); app.UseSession(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "areas", pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}"); endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapRazorPages(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) // , IServiceProvider serviceProvider { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); // app.UseExceptionHandler(builder => builder.Run(async context => await x_DOVEHelper.ErrorEventAsync(context, env))); } else { // app.UseDeveloperExceptionPage(); app.UseExceptionHandler(builder => builder.Run(async context => await x_DOVEHelper.ErrorEventAsync(Configuration, context))); app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } ServiceLocator.Instance = app.ApplicationServices; app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseRequestLocalization(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "areas", template: "{area:exists}/{controller=Home}/{action=Index}/{id?}" ); routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); #region CUSTOM_APP_INITIALIZATION var LFilesPath = env.ContentRootPath + "/Data/LFiles"; var AvatarPath = $"{LFilesPath}/Avatars"; var XUserFilePath = $"{LFilesPath}/XUserFile"; foreach (var p in new string[] { AvatarPath, XUserFilePath }) { if (!Directory.Exists(p)) { Directory.CreateDirectory(p); } } #endregion }