GZIP in .net core not working

后端 未结 7 1099
不思量自难忘°
不思量自难忘° 2021-02-03 22:38

I\'m attempting to add Gzip middleware to my ASP.net core app.

I have added the following package :

\"Microsoft.AspNetCore.ResponseCompression\"

7条回答
  •  天命终不由人
    2021-02-03 22:44

    Got this issue resolved by adding response compression option property "EnableForHttps" as shown below:

    services.AddResponseCompression(opt =>
            {
                opt.Providers.Add();
                opt.EnableForHttps = true;
            });
     services.Configure(options => options.Level = 
     CompressionLevel.Fastest);
    

提交回复
热议问题