NetworkError: 404 Not Found - http://www.companyName.com/Content/fonts/ubuntu-regular-webfont.woff2
网站是使用BootStrap框架实现,当站点发布至服务器(Windows Server 2008 R2)IIS之后,显示下面的异常:
Insus.NET跑至相关目录之下检查,这些字体的文件是确实存在的。
为什么这样呢? 令Insus.NET想起前些日子,解决视频PM4的问题《在IIS启用MP4》http://www.cnblogs.com/insus/p/5507493.html 肯定又是IIS没有MIME Type的原因:
原web.config配置:
<system.webServer> <staticContent> <remove fileExtension=".woff"/> <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> <remove fileExtension=".woff2"/> <mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" /> <remove fileExtension=".ttf" /> <mimeMap fileExtension=".ttf" mimeType="application/x-font-truetype" /> <remove fileExtension=".svg" /> <mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> <remove fileExtension=".otf" /> <mimeMap fileExtension=".otf" mimeType="application/x-font-opentype" /> <remove fileExtension=".eot" /> <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> </staticContent> </system.webServer>