Пример #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IOptions <AppSettings> appSettingsSection)
        {
            app.UseAuthentication();

            app.UseMvc();

            //print in output
            HostHelper.OutputHostnameInfo(appSettingsSection.Value.ApplicationTitle);
        }
Пример #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IOptions <AppSettings> appSettingsSection)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            //app.UseForwardedHeaders(new ForwardedHeadersOptions
            //{
            //    ForwardedHeaders = Microsoft.AspNetCore.HttpOverrides.ForwardedHeaders.XForwardedProto
            //});
            //register identity server in DI
            app.UseIdentityServer();

            //print in output
            HostHelper.OutputHostnameInfo(appSettingsSection.Value.ApplicationTitle);
        }
Пример #3
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, IOptions <AppSettings> appSettingsSection)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCommunicationMiddleware();

            var supportedCultures = new[] {
                new CultureInfo("en-US"),
                new CultureInfo("en"),
                new CultureInfo("es"),
            };

            app.UseRequestLocalization(new RequestLocalizationOptions
            {
                DefaultRequestCulture   = new RequestCulture(new CultureInfo("es")),
                SupportedCultures       = supportedCultures,
                SupportedUICultures     = supportedCultures,
                RequestCultureProviders = new List <IRequestCultureProvider>
                {
                    new QueryStringRequestCultureProvider
                    {
                        QueryStringKey   = "culture",
                        UIQueryStringKey = "ui-culture"
                    }
                }
            });

            app.UseMvc();

            env.ConfigureNLog("nlog.config");
            // make sure other languages chars wont mess up
            //Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

            //add NLog to asp.net core
            loggerFactory.AddNLog();

            //add Nlog.Web
            app.AddNLogWeb();

            //print in output
            HostHelper.OutputHostnameInfo(appSettingsSection.Value.ApplicationTitle);
        }