Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
- {
- if (env.IsDevelopment())
- {
- loggerFactory.AddDebug(LogLevel.Debug);
- app.UseDeveloperExceptionPage();
- app.UseBrowserLink();
- }
- else
- {
- app.UseExceptionHandler("/error");
- }
- app.UseStatusCodePagesWithRedirects("/error/{0}");
- app.UseResponseCompression();
- app.UseStaticFiles(new StaticFileOptions
- {
- OnPrepareResponse = ctx =>
- {
- ctx.Context.Response.Headers.Append("Cache-Control", "public, max-age=604800");
- }
- });
- app.UseAuthentication();
- app.UseMvc(routes =>
- {
- routes.MapRoute(
- name: "areas",
- template: "{area:exists}/{controller=Home}/{action=Index}/{id?}"
- );
- routes.MapRoute(
- name: "default",
- template: "{controller=Home}/{action=Index}/{id?}");
- });
- var options = new RewriteOptions()
- .AddRedirectToHttps();
- app.UseRewriter(options);
- }
- WebHost.CreateDefaultBuilder(args)
- .ConfigureServices(services =>
- {
- services.AddResponseCompression();
- })
- .Configure(app =>
- {
- app.UseResponseCompression();
- // ...
- })
- .Build();
Add Comment
Please, Sign In to add comment