Fonts not loaded when deploying website on Azure

时间:2015-06-15 14:38:32

标签: asp.net azure fonts

When I test my website (ASP.NET) offline, my fonts are loaded correctly. When I deploy my website on Azure, I get this error message for the fonts in my browser.

Failed to load resource: the server responded with a status of 404 (Not Found)

I already put these lines in my Web.config file:

<system.webServer>
<staticContent>
  <remove fileExtension=".woff" />
  <remove fileExtension=".woff2" />
  <remove fileExtension=".ttf" />
  <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
  <mimeMap fileExtension=".woff2" mimeType="application/x-woff2" />
  <mimeMap fileExtension=".ttf" mimeType="application/x-ttf" />
</staticContent>

I'm using the CSS framework materializecss.

1 个答案:

答案 0 :(得分:3)

首先,对我有用的哑剧类型是这样的:

<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/x-font-woffs" />
<mimeMap fileExtension=".ttf" mimeType="application/x-font-ttf" />

然后确保使用正确的路径,您可能需要编辑css文件中的URL以指向正确的字体文件路径。

同时检查bundle issue on azure它对我有帮助。