2

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.

Jona
  • 81
  • 1
  • 7
  • Are you bundling your css resources by any chance? – Gaurav Mantri Jun 15 '15 at 14:57
  • Yes my css was bundled. I just replaced the bundle by link tags en the fonts are correctly loaded on Azure. Thanks. – Jona Jun 15 '15 at 16:01
  • Take a look at this thread: http://stackoverflow.com/questions/19664287/bootstrap-icons-are-loaded-locally-but-not-when-online. See if the problem you are facing is because of that only. HTH. – Gaurav Mantri Jun 15 '15 at 16:29
  • I had already tried the answer from that link with no succes. There will now be one css file that isn't in the bundle, wich is not so bad. – Jona Jun 15 '15 at 16:46

1 Answers1

4

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.

Amr Elgarhy
  • 66,568
  • 69
  • 184
  • 301
  • Devs busy deploying asp.net apps to azure should also take note of [this answer](https://stackoverflow.com/a/35898578/1326996) in case they still get some errors. Might want to update this to be inclusive (and marked as correct!). – barnacle.m Jan 14 '18 at 17:46