首页 > 其他分享 >.net core 压缩数据、用户响应压缩

.net core 压缩数据、用户响应压缩

时间:2022-08-26 16:33:21浏览次数:68  
标签:core builder 压缩 options var net app

https://docs.microsoft.com/zh-cn/aspnet/core/performance/response-compression?view=aspnetcore-6.0

 

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddResponseCompression(options =>
{
  options.EnableForHttps = true;
});

var app = builder.Build();

app.UseResponseCompression();//用户响应压缩,全局有效(只有这一行代码)

app.MapGet("/", () => "Hello World!");

app.Run();

标签:core,builder,压缩,options,var,net,app
From: https://www.cnblogs.com/hao-1234-1234/p/16627966.html

相关文章