Microsoft.AspNet.WebApi.MessageHandlers.Compression
Microsoft.AspNet.WebApi.MessageHandlers.Compression copied to clipboard
Not compressed in new ASP.NET MVC 5 app
I have installed the Microsoft.AspNet.WebApi.MessageHandlers.Compression.Server package and added the handler
private static void RegisterMessageHandlers(this HttpConfiguration config)
{
config.MessageHandlers.Insert(0, new ServerCompressionHandler(new GZipCompressor(), new DeflateCompressor()));
}
Unfortunatelly, as I see in Fiddler, the compression is not enabled:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json
Expires: -1
Server: Microsoft-IIS/10.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 17 May 2018 10:51:26 GMT
Transfer-Encoding: chunked
Is there something I have missed?
I have encountered the same situation as you. If I turn off the web protection function of antivirus or changed the the value of agent header in request, the compression works.