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

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

作者:互联网

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
来源: https://www.cnblogs.com/hao-1234-1234/p/16627966.html