Exemplo n.º 1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            env.CheckNotNull(nameof(env));
            app.CheckNotNull(nameof(app));

            // Validate configuration settings at startup.
            app.ApplicationServices.GetService <IOptions <EmailConfig> >().Value.CheckNotNull("Config: Email");
            app.ApplicationServices.GetService <IOptions <LatestArticlesConfig> >().Value.CheckNotNull("Config: LatestArticles");

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
            });
            app.UseStatusCodePagesWithReExecute("/error/{0}");
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
            });
        }
Exemplo n.º 2
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            env.CheckNotNull(nameof(env));
            app.CheckNotNull(nameof(app));

            // Validate configuration settings at startup.
            app.ApplicationServices.GetService <IOptions <EmailConfig> >().Value.CheckNotNull("Config: Email");
            app.ApplicationServices.GetService <IOptions <OntraportConfig> >().Value.CheckNotNull("Config: Ontraport");
            app.ApplicationServices.GetService <IOptions <BluePayConfig> >().Value.CheckNotNull("Config: BluePay");


            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHeadElementServerPrerendering();
            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
            });
            app.UseStatusCodePagesWithReExecute("/error/{0}");
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseRouting();
            // app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
                //endpoints.MapRazorPages();
            });
        }