[Fixed] 404 Not Found Error for .Woff, .otf font in ASP.NET MVC

In this blog post, I will show a simple fix for the error HTTP 404 Not Found for the font files e.g. woff, woff2, otf etc. used in ASP.NET or MVC or Azure.

I was creating a dynamic ad and in that ad I have to show custom font-family. I added the font but it wasn’t reflecting on Azure. It was working fine on local.

So after some research, I found, it’s due to every file that gets requested from the server must have valid MIME type in the request so if there is a problem with these MIME types you face such errors.

To fix this issue just open web.config file of your site and add the following content under configuration section.

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

It will help.


Posted by | View Post | View Group