Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mvc 4 script bundles and GZip

I've add all scripts from my site into very big bundle (about 700kb). And now I want IIS to gzip it, but i can't.

I've tried everything I've found here and over the web, but nothing helps. Static *.js files age gzipped, but complete bundle not.

Is there any solution ?

like image 968
Yavanosta Avatar asked Jan 07 '13 21:01

Yavanosta


1 Answers

Check the dynamic compression in IIS. It have to be enabled for both IIS and your website. You also must have a valid config in the applicationHost.config too.

<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/x-javascript" enabled="true" />
            <add mimeType="application/json" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </dynamicTypes>
        <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" 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="*/*" enabled="false" />
        </staticTypes>
    </httpCompression>

Important Note : the content type of Bundling response is text/javascript, so check your config for this type.

like image 130
Cybermaxs Avatar answered Sep 26 '22 00:09

Cybermaxs