1

I am using page speed tool in google chrome and find below results.

For Localhost website: Page Speed Score: 92/100

For website IIS 7: Page Speed Score: 61/100

I used below code in web.config to enable compression

 <system.webServer>
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
      <dynamicTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/javascript" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/javascript" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
      </staticTypes>
    </httpCompression>
    <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
      <remove name="OPTIONSVerbHandler"/>
      <remove name="TRACEVerbHandler"/>
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
    </handlers>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>

But still score on IIS are 61/100 and its showing ENABLE COMPRESSION.

What am I missing in my config to enable compression ?

Gaurav123
  • 4,455
  • 6
  • 41
  • 73
  • are you sure each mimetype that is served is indeed compressed? For example images wouldn't be compressed based on above config. – rene Oct 10 '16 at 09:36
  • I used this http://stackoverflow.com/questions/702124/enable-iis7-gzip – Gaurav123 Oct 10 '16 at 09:41
  • Well, verify in the dev console if each response header contains Content-encoding:gzip. If not, share what content-type that is. – rene Oct 10 '16 at 09:43
  • @rene You are right I didn't read the question properly, I think it was how to enable it. – mybirthname Oct 10 '16 at 09:49
  • These are content type ``Content-Type:text/css; charset=utf-8`` , ``Content-Type:text/javascript; charset=utf-8`` , – Gaurav123 Oct 10 '16 at 09:54
  • So your CSS files and Javascript files are not compressed, right? – rene Oct 10 '16 at 09:57
  • I have created bundles for javascript and jss...while I running the code on localhost page score is 92/100 however on IIS its 61/100, so I am not sure if JS and CSS are compressing or not – Gaurav123 Oct 10 '16 at 10:00
  • On localhost, I am getting ``Content-Encoding:gzip`` what changes required to achieve the same on IIS ? – Gaurav123 Oct 10 '16 at 10:13

1 Answers1

0

This is what I added to my web.config when page speed tool reported low score due to no compression.

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
  <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
  <dynamicTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="text/javascript" enabled="true" />
    <add mimeType="text/css" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </dynamicTypes>
  <staticTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="text/javascript" enabled="true" />
    <add mimeType="text/css" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="application/atom+xml" enabled="true" />
    <add mimeType="application/xaml+xml" enabled="true" />
    <add mimeType="image/png" enabled="true"/>
    <add mimeType="image/jpg" enabled="true"/>
    <add mimeType="*/*" enabled="false" />
  </staticTypes>
</httpCompression>
<urlCompression doDynamicCompression="true" doStaticCompression="true" />
Ravi A.
  • 2,003
  • 1
  • 16
  • 23