Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
        {
            // Start logging
            loggerFactory.AddConsole(LogLevel.Debug);

            // Before we setup the pipeline, get the database up
            AppDatabase.InitializeDatabase(app.ApplicationServices,
                                           isProduction: _hostingEnvironment.IsProduction());
            AppDatabase.EnsureIdentityDatabaseExists(app.ApplicationServices,
                                                     isProduction: _hostingEnvironment.IsProduction());

            // Setup pipeline
            if (_hostingEnvironment.IsDevelopment())
            {
                app.UseRuntimeInfoPage();
                app.UseBrowserLink();
            }
            else
            {
            }

            // Error Handling and Diagnostics
            app.UseDeveloperExceptionPage();

            // Shows database operation failures. Good incase you've missed a migration.
            app.UseDatabaseErrorPage();

            // Use Asp.Net Identity
            app.UseIdentity();

            // Allows any static content in wwwroot to be servered
            app.UseStaticFiles();

            // Config MVC6
            app.UseMvc(config =>
            {
                config.MapRoute(
                    name: "default",
                    template: "{controller=App}/{action=Index}/{id?}");
            });
        }