Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApiVersionDescriptionProvider provider, IAppConfig appConfig)
        {
            appConfig.EnvironmentString = env.EnvironmentName;

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage(); // Provides detailed error info *** Don't enable in PROD!!!!!! ***
            }
            else
            {
                app.UseHsts(); // send HTTP Strict Transport Security Protocol (HSTS) headers to clients.
            }

            NLogStartup.SetNLogConfig(appConfig);  // Setup NLog Config and connection string
            app.UseSwaggerStartup(provider);       // Swagger provides interactive API exploration and execution
            app.UseHttpsRedirection();             // Redirect HTTP requests to HTTPS.

            app.UseMiddleware <LoggingMiddleware>();

            app.UseMvc();             // Configures MVC routing middleware
        }
 public static void Main(string[] args)
 {
     NLogStartup.ConfigureNLog();
     CreateHostBuilder(args).Build().Run();
 }