使用 MVC 5,我在应用程序中包含了 Fontello 图标。 我的字体文件夹中有以下文件类型: eot、ttf、woff、woff2、svg
在本地运行应用程序,图标看起来不错,但在 Azure 中运行时,它们不会显示。
按照以下建议: http://codingstill.com/2013/01/set-mime-types-for-web-fonts-in-iis/ ,我在web.config中添加了以下代码:
<system.webServer>
<staticContent>
<remove fileExtension=".eot" />
<remove fileExtension=".ttf" />
<remove fileExtension=".svg" />
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>
这没有帮助,图标仍然不显示,我收到以下控制台错误:
The link http://{myapplication}.azurewebsites.net/fonts/font/fontello.woff?50484361 Failed to load resource: the server responded with a status of 404 (Not Found)
但我只得到 5 种文件类型中的 3 种:(ttf、woff 和 woff2)。
注意:文件确实存在,并且位于正确的位置!
有什么想法吗?
最佳答案
这就是问题的解决方法 --- 谢谢 @GauravMantri 的解决方案!!
文件:
\fonts\font\fontello.ttf
\fonts\font\fontello.woff
\fonts\font\fontello.woff2
在我的本地环境中物理上确实存在于磁盘上,因此本地运行没问题。 但它们实际上并不是解决方案的一部分,因此没有部署到 Azure。
See this image
所有需要做的事情:
右键单击 VS 中的文件 => '包含在项目中' 然后再次发布到Azure..
关于asp.net-mvc - Fontello 图标未显示在 Azure Web 应用程序中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39050988/