예제 #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?}");
            });
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

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

            // Allow any client from any origin to use our API
            app.UseCors("AllowAll");

            app.UseStatusCodePages();

            app.UseDefaultFiles();
            app.UseStaticFiles();

            app.UseMvc();
        }