using HackerNet.Infrastructure.AspNet; var builder = WebApplication.CreateBuilder(args); // Add services to the container. //ServiceCollectionExtensions.AddHackerNetServices(builder.Services); builder.Services .AddHackerNetServices() .AddControllersWithViews(o => { //o.Filters.Add(); }); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.Use(async (ctx, next) => { var logger = ctx.RequestServices.GetRequiredService>(); logger.LogDebug(">>>>>>>>>>>>>> Début requête"); try { await next(); } catch (Exception e) { // Envoi app insights ou autre logger.LogError(e.Message); throw e; } logger.LogDebug("<<<<<<<<<<<<<< Fin requête"); }); app.Use(async (ctx, next) => { var logger = ctx.RequestServices.GetRequiredService>(); logger.LogDebug(">>>>>>>>>>>>>> Début requête 2"); await next(); logger.LogDebug("<<<<<<<<<<<<<< Fin requête 2"); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseStatusCodePagesWithRedirects("/{0}"); app.UseRouting(); // app.UseAuthentication(); app.UseAuthorization(); app.MapControllerRoute( name: "default", pattern: "{controller=Links}/{action=Index}/{id?}"); app.Run();