1

I have to enable HttpCompression for .svg files on a particular Website instead of enabling in whole IIS server.

To overcome this I have added the httpCompression configuration setting in web.config of the particular website by adding svg MIME type in both Static and Dynamic types, but it is not enabling.

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
        <scheme name="gzip" doStaticCompression="true" doDynamicCompression="true" dll="%Windir%\system32\inetsrv\gzip.dll" dynamicCompressionLevel="9" />
        <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="*/*" enabled="false" />
            <add mimeType="image/svg+xml" enabled="true" />
        </staticTypes>
        <dynamicTypes>
            <add mimeType="application/json; charset=utf-8" enabled="true" />
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="*/*" enabled="false" />
            <add mimeType="image/svg+xml" enabled="true" />
        </dynamicTypes>
    </httpCompression> 

When I add the same MIME type in the application.host config file it is working fine but it is enabling for whole IIS server.

Is there a way to override the HTTPCompression setting in the application.host config with the particular website web.config file.

  • Only in IIS 10 https://blogs.msdn.microsoft.com/friis/2017/09/05/iis-dynamic-compression-and-new-dynamic-compression-features-in-iis-10/ this is a related answer https://stackoverflow.com/a/49157890/791245 – Carlos Casalicchio Apr 23 '19 at 20:54

0 Answers0