// 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) { //Configure logs loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace); var pathBase = Configuration["PATH_BASE"]; if (!string.IsNullOrEmpty(pathBase)) { loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'"); app.UsePathBase(pathBase); } #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously app.Map("/liveness", lapp => lapp.Run(async ctx => ctx.Response.StatusCode = 200)); #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously app.UseCors("CorsPolicy"); app.UseMvcWithDefaultRoute(); HttpContextExtensions.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>()); //app.UseSwagger() // .UseSwaggerUI(c => // { // c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "MainAPI V1"); // }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.Map("/dist", ctx => ctx.UseSpa( spa => { spa.Options.SourcePath = "wwwroot"; spa.UseProxyToSpaDevelopmentServer("http://localhost:8400/"); })); app.UseDeveloperExceptionPage(); } else { app.UseStaticFiles(); app.UseSpaStaticFiles(); } app.UseAuthentication(); IHttpContextAccessor httpContextAccessor = app.ApplicationServices.GetRequiredService <IHttpContextAccessor>(); HttpContextExtensions.Configure(httpContextAccessor); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapDefaultControllerRoute(); endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); }); }