コード例 #1
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,
                              ApplicationDbContext context)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            Migrate(app);
            //app.UseIISPlatformHandler(); // options => options.AuthenticationDescriptions.Clear());

            app.UseStaticFiles();
            app.UseCors(CORS_POLICY_NAME);

            app.UseAuthentication();

            // To configure external authentication please see http://go.microsoft.com/fwlink/?LinkID=532715

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Order}/{action=Index}/{id?}");
            });

            SampleData.Initialize(app.ApplicationServices);
            AuthData.SeedAuth(app.ApplicationServices).Wait();
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: aabramovv/vproker
        // 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,
                              ApplicationDbContext context)
        {
            // setting Ru culture helped for showing right currency, but does not for DateTime
            var cultureInfo = new CultureInfo("ru-RU");

            cultureInfo.NumberFormat.CurrencyDecimalDigits = 0;
            CultureInfo.DefaultThreadCurrentCulture        = cultureInfo;
            CultureInfo.DefaultThreadCurrentUICulture      = cultureInfo;
            Thread.CurrentThread.CurrentCulture            = cultureInfo;
            Thread.CurrentThread.CurrentUICulture          = cultureInfo;

            // don't see a diff, but leaving the following lines too
            var localizationOptions = new RequestLocalizationOptions()
            {
                SupportedCultures = new List <CultureInfo>()
                {
                    cultureInfo
                },
                SupportedUICultures = new List <CultureInfo>()
                {
                    cultureInfo
                },
                DefaultRequestCulture      = new RequestCulture(cultureInfo),
                FallBackToParentCultures   = false,
                FallBackToParentUICultures = false,
                RequestCultureProviders    = null
            };

            app.UseRequestLocalization(localizationOptions);

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            Migrate(app);
            //app.UseIISPlatformHandler(); // options => options.AuthenticationDescriptions.Clear());

            app.UseStaticFiles();
            app.UseCors(CORS_POLICY_NAME);

            app.UseAuthentication();

            // To configure external authentication please see http://go.microsoft.com/fwlink/?LinkID=532715

            app.UseMvc(routes =>
            {
                routes.MapRoute(null, "{controller}/{action}");

                routes.MapRoute(
                    name: "default",
                    template: "{controller=Order}/{action=Index}/{id?}");
            });

            SampleData.Initialize(app.ApplicationServices);

            //ExtractClients.Process(app.ApplicationServices);

            //ReadClients.ReadFromFile(app.ApplicationServices);

            //PassportCheck.LimitExpiredPassports("36");

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
            });
            AuthData.SeedAuth(app.ApplicationServices).Wait();
        }