【发布时间】:2015-09-22 16:20:00
【问题描述】:
经过一些研究,我注意到为了在 IIS 中使用 woff2 字体类型,您需要在 Web 项目的 web.config 中设置以下内容,以避免从服务器获得 404:
<staticContent>
<remove fileExtension=".woff"/>
<remove fileExtension=".woff2"/>
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
在本地,这似乎可行,但是当项目部署在 IIS 上时,我不断收到 404,问题可能是什么原因?谢谢
【问题讨论】:
-
您确定您的目标 IIS 版本是 IIS 7 或更高版本吗?否则,在 IIS 6 及更低版本中,web.config system.webServer 部分(如 staticContent)将被忽略
-
是的,目标服务器在 IIS 7 之上
标签: asp.net iis web-config woff2