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, ILoggerFactory loggerFactory, CityInfoContext cityInfoContext)
        {
            loggerFactory.AddConsole();

            loggerFactory.AddDebug();

            //loggerFactory.AddProvider(new NLog.Extensions.Logging.NLogLoggerProvider());

            loggerFactory.AddNLog();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler();
            }

            cityInfoContext.EnsureSeeDataForContext();

            app.UseStatusCodePages();

            app.UseMvc();

            //app.UseMvc(config =>
            //{
            //	config.MapRoute(
            //		name: "Default",
            //		template: "{controller}/{action}/{id?}",
            //		defaults: new { controller = "Home", action = "Index" }
            //		);
            //});

            //app.Run((context) =>
            //{
            //	throw new Exception("Example exception");
            //});

            //app.Run(async (context) =>
            //{
            //	await context.Response.WriteAsync("Hello World!");
            //});
        }