示例#1
0
        public void Configure(IApplicationBuilder app,
                              IWebHostEnvironment env,
                              IOptions <AppSettings> appSettings)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            var options = new RewriteOptions();

            options.AddAzureHostnameRedirect(appSettings.Value.Hostname);
            app.UseRewriter(options);

            app.UseStatusCodePagesWithReExecute("/error/{0}");
            app.UseRouting();
            app.UseStaticFiles();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }