Guest User

Untitled

a guest
May 24th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  2. {
  3. if (env.IsDevelopment())
  4. {
  5. loggerFactory.AddDebug(LogLevel.Debug);
  6. app.UseDeveloperExceptionPage();
  7. app.UseBrowserLink();
  8. }
  9. else
  10. {
  11. app.UseExceptionHandler("/error");
  12. }
  13.  
  14. app.UseStatusCodePagesWithRedirects("/error/{0}");
  15. app.UseResponseCompression();
  16.  
  17. app.UseStaticFiles(new StaticFileOptions
  18. {
  19. OnPrepareResponse = ctx =>
  20. {
  21. ctx.Context.Response.Headers.Append("Cache-Control", "public, max-age=604800");
  22. }
  23. });
  24.  
  25. app.UseAuthentication();
  26.  
  27. app.UseMvc(routes =>
  28. {
  29. routes.MapRoute(
  30. name: "areas",
  31. template: "{area:exists}/{controller=Home}/{action=Index}/{id?}"
  32. );
  33.  
  34. routes.MapRoute(
  35. name: "default",
  36. template: "{controller=Home}/{action=Index}/{id?}");
  37. });
  38.  
  39. var options = new RewriteOptions()
  40. .AddRedirectToHttps();
  41.  
  42. app.UseRewriter(options);
  43. }
  44.  
  45. WebHost.CreateDefaultBuilder(args)
  46. .ConfigureServices(services =>
  47. {
  48. services.AddResponseCompression();
  49. })
  50. .Configure(app =>
  51. {
  52. app.UseResponseCompression();
  53.  
  54. // ...
  55. })
  56. .Build();
Add Comment
Please, Sign In to add comment