我创建了一个web.config文件,该文件成功打开了文本和消息资源的静态压缩.但是,下面显示的显而易见的解决方案似乎对.svg压缩没有任何影响(验证gzip内容编码未在.svg文件的响应头中设置,但是通过chrome开发人员工具设置为.html,css等) .
这是我的web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpCompression minFileSizeForComp="1024" MaxDiskSpaceUsage="500">
<scheme name="gzip"/>
<staticTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="image/svg+xml" enabled="true"/>
<add mimeType="application/json" enabled="true" />
<add mimeType="*/*" enabled="false"/>
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<remove fileExtension=".svgz" />
<mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
</staticContent>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
此问题的动机是按照Google Page Speed Insights的建议提供压缩的SVG字体.我一直在IIS 7.5/Windows 7和IIS 8/Windows Server 2012上测试这个web.config.
有任何想法吗?