Exemple #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, ITextContext context)
        {
            context.Migrate();

            app.UseAuthentication();

            var cultures = new[] { new CultureInfo("en"), new CultureInfo("de") };

            var localisationOptions = new RequestLocalizationOptions {
                DefaultRequestCulture = new RequestCulture("en"), SupportedCultures = cultures, SupportedUICultures = cultures
            };

            app.UseRequestLocalization(localisationOptions);

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

            app.UseStaticFiles();

            /*/ Hangfire configuration
             * var options = new SQLiteStorageOptions();
             * GlobalConfiguration.Configuration.UseSQLiteStorage("Data Source = E:\\OneDrive\\SourceCodes\\Study\\ASPNetHangfireSQLite\\ASPNetHangfireSQLite\\App_Data\\Hangfire.sqlite", options);
             * var option = new BackgroundJobServerOptions { WorkerCount = 1 };
             * app.UseHangfireServer(option);
             * app.UseHangfireDashboard();
             * // Add scheduled jobs
             * RecurringJob.AddOrUpdate(() => Run(), Cron.Minutely);*/

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