shazia perween
shazia perween

Reputation: 607

woff2, woff and ttf files not loaded and gave 400 error

Why woff2, woff and ttf files are not loaded, however they are exist in "assets" folder? Please suggest!

enter image description here

Upvotes: 2

Views: 3262

Answers (1)

peinearydevelopment
peinearydevelopment

Reputation: 11464

The problem is that those mime types aren't set for your IISExpress instance. Answer originally found here.

Answer 1: This will fix the error for all sites that create that have these file types as a part of their solution and are being run out of IISExpress.

Quoted in part:

Open ApplicationHost.config located in C:\Users\<user>\Documents\IISExpress\config

Locate staticContent section and append the following lines before the closing tag: <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> <mimeMap fileExtension=".woff2" mimeType="application/font-woff" /> <mimeMap fileExtension=".ttf" mimeType="application/octet-stream />

Answer 1: This will fix the error for that particular site, but any others that you create that have these file types as a part of their solution and are being run out of IISExpress will encounter this same issue.

Update the Web.config for your project. Add <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> <mimeMap fileExtension=".woff2" mimeType="application/font-woff" /> <mimeMap fileExtension=".ttf" mimeType="application/octet-stream /> in the staticContent section in system.webServer in configuration.

This should get those annoying errors to go away!

Upvotes: 2

Related Questions