public void Configure(IApplicationBuilder app, IApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory) { loggerFactory.AddNLog(); HostingEnvironment.ConfigureNLog($"nlog.{HostingEnvironment.EnvironmentName}.config"); if (HostingEnvironment.IsDevelopment() || HostingEnvironment.IsStaging()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(s => s.SwaggerEndpoint("/swagger/v1/swagger.json", "Streetwood API")); } else { app.UseHsts(); } app.UseCors(s => { s.AllowAnyOrigin(); s.AllowAnyHeader(); s.AllowAnyMethod(); }); // app.UseHttpsRedirection(); app.UseAuthentication(); app.UseStaticFiles(); app.UseMiddleware <ExceptionHandlerMiddleware>(); app.UseMvc(); applicationLifetime.ApplicationStopped.Register(() => Container.Dispose()); }
public void Configure(IApplicationBuilder app, IApplicationLifetime appLifetime, IServiceProvider serviceProvider, ILoggerFactory loggerFactory) { loggerFactory.AddNLog(); HostingEnvironment.ConfigureNLog($"nlog.{HostingEnvironment.EnvironmentName}.config"); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Awesome ToDo API v1")); app.UseCors(cors => { cors.AllowAnyOrigin(); cors.AllowAnyMethod(); cors.AllowAnyHeader(); }); app.UseMiddleware(typeof(ExceptionHandlerMiddleware)); app.UseAuthentication(); app.UseMvc(); appLifetime.ApplicationStopped.Register(() => Container.Dispose()); }