c# - GZIP in .net core not working -


i'm attempting add gzip middleware asp.net core app.

i have added following package :

"microsoft.aspnetcore.responsecompression": "1.0.0"

in startup.cs configure services method have following :

public void configureservices(iservicecollection services) {     services.configure<gzipcompressionprovideroptions>(options => options.level = compressionlevel.fastest);     services.addresponsecompression(options =>     {         options.providers.add<gzipcompressionprovider>();     });      services.addmvc(); } 

in configure method have following :

public void configure(iapplicationbuilder app, ihostingenvironment env, iloggerfactory loggerfactory) {     loggerfactory.addconsole(configuration.getsection("logging"));     loggerfactory.adddebug();      app.useresponsecompression();     app.usemvc(); } 

however when try , load page, doesn't come through gzip compressed. have used both string response , outputting view. response headers in chrome :

enter image description here

i on windows machine developing in visual studio. when running app have tried running visual studio (via f5), , using "dotnet run" command command line. neither output gzip compression.

by placing useresponsecompression twice under each other managed make work. have no idea how made work. still looking accepted solution.


Comments

Popular posts from this blog

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -