WebDevGuy2
WebDevGuy2

Reputation: 1249

FontAwesome webfont files giving error 404 (Not Found) on Windows Server running IIS 7.5

Working on MVC5 app. Works like a charm on local dev box. Copied files to server and the fontawesome related stuff is not working. I'm getting these errors in the dev tools for Chrome...

fontawesome-webfont.woff2 Failed to load resource: 
       the server responded with a status of 404 (Not Found)
fontawesome-webfont.woff Failed to load resource: 
       the server responded with a status of 404 (Not Found)
fontawesome-webfont.ttf Failed to load resource: 
       the server responded with a status of 404 (Not Found)

Yes, the files are there on the server.

Server info: Windows Server 2008 R2 Standard; IIS 7.5.7600.16385

After much research, I've found several solutions online, in regards to adding MIME lines to web.config. There are several variations, but none of them seem to work. For example, for .woff, I've tried...

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

also

<mimeMap fileExtension=".woff" mimeType="application/font-woff" />

etc...

First I removed the items. For example...

<remove fileExtension=".woff" />

Any other suggestions? The screenshot will show Chromes debugger (404), also the IIS MIME entries and the web.config MIME section.

enter image description here

Upvotes: 4

Views: 6699

Answers (1)

Kyle
Kyle

Reputation: 1043

This solved that issue for me: Put the following in your system.webServer tags:

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

Upvotes: 1

Related Questions