Jona
Jona

Reputation: 91

Fonts not loaded when deploying website on Azure

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.

Upvotes: 3

Views: 3773

Answers (1)

Amr Elgarhy
Amr Elgarhy

Reputation: 68902

First of all the mime types which worked for me was like these:

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

Then make sure that the correct paths are used, you may need to edit the URLs inside your css files to point to the correct font files paths.

And also check this bundle issue on azure it helped me as well.

Upvotes: 5

Related Questions