// 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) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); loggerFactory.AddNLog(); // Configure nlog.config in your project root env.ConfigureNLog("nlog.config"); // Configure exception handling if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(); } // Use built-in display of status code pages app.UseStatusCodePages(); // Ensure support of static resource files app.UseStaticFiles(); var context = app.ApplicationServices.GetService <ApiContext>(); var dbInit = new InitializeDatabase(env, context); dbInit.Seed(); // Add default mvc route definition app.UseMvcWithDefaultRoute(); // Enable middleware to serve generated Swagger as a JSON endpoint app.UseSwagger(); // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.) app.UseSwaggerUi(); }