增加功能:Client网站增加网站压缩功能默认采用gzip

This commit is contained in:
Argo-MacBookPro 2018-11-03 10:25:44 +08:00
parent 08c2e808ba
commit ee6c2447d7
1 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,7 @@ namespace Bootstrap.Client
.PersistKeysToFileSystem(new DirectoryInfo(Configuration["KeyPath"])); .PersistKeysToFileSystem(new DirectoryInfo(Configuration["KeyPath"]));
if (Configuration["DisableAutomaticKeyGeneration"] == "True") dataProtectionBuilder.DisableAutomaticKeyGeneration(); if (Configuration["DisableAutomaticKeyGeneration"] == "True") dataProtectionBuilder.DisableAutomaticKeyGeneration();
services.AddSignalR().AddJsonProtocalDefault(); services.AddSignalR().AddJsonProtocalDefault();
services.AddResponseCompression();
services.AddMvc(options => services.AddMvc(options =>
{ {
options.Filters.Add<BootstrapAdminAuthorizeFilter>(); options.Filters.Add<BootstrapAdminAuthorizeFilter>();
@ -80,6 +81,7 @@ namespace Bootstrap.Client
app.UseStatusCodePagesWithReExecute("/Home/Error/{0}"); app.UseStatusCodePagesWithReExecute("/Home/Error/{0}");
app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials()); app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials());
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseResponseCompression();
app.UseStaticFiles(); app.UseStaticFiles();
app.UseCookiePolicy(); app.UseCookiePolicy();
app.UseAuthentication(); app.UseAuthentication();