iis - 如何让 IIS 压缩 .svg 文件?

标签 iis optimization compression gzip

我正在尝试在 web.config 中完成此操作:

<staticContent>
  <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
<httpCompression>
    <staticTypes>
        <add mimeType="image/svg+xml" enabled="true"/>
    </staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>

但是Content-Encoding: gzip永远不会出现在响应头中。不过,压缩对 CSS 等其他类型也很有效。

最佳答案

@Dominique Alexandre 指出了一个解决方案,该解决方案展示了如何编辑 applicationHost.config 文件,该文件工作正常。

我只想添加如何使用 IIS 管理器 GUI 执行此操作。

转到 IIS 管理器 > YOUR_SERVER > 在管理部分 > 配置编辑器 > 展开 system.webServer > httpCompression > dynamicTypes

然后添加您要额外压缩的 mime 类型。

关于iis - 如何让 IIS 压缩 .svg 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12734534/

相关文章:

asp.net - IIS - 需要特定 MVC Controller 的 SSL 客户端证书

c - 透明的 SQLite 数据压缩

c++ - 什么是 C++ 优化和 Visual Studio 中的整个程序优化

git - Git 如何既节省空间又快速?

hadoop - 启用 dfs.image.compress 时会压缩什么?

iis - ASP.NET Core 部署到 IIS 错误 : Development environment should not be enabled in deployed applications

asp.net-mvc - 在单个 IIS 服务器上部署使用 Azure AD 进行身份验证的两个应用程序时,身份验证页面不断无限循环

asp.net - HttpContext.Current.User.Principal 与 WindowsIdentity.GetCurrent()

c - 向后读取大文本文件的最有效方法是什么?

algorithm - 带约束的矩形包装