Friday, September 12, 2014

Using font-face and .woff files in IIS

After pushing an ASP.NET MVC Web app into acceptance, some users complained that the fonts looked ugly. When investigating the issue we noticed that on Chrome and Firefox a 404 error was thrown when loading a .woff font file in the browser. This prevented the @fontcase specification in our CSS to load the correct font and style our text.

We discovered that the MIME type is missing for .woff files in IIS. Luckily, this is an easy one to fix. Open up your web.config and add the following section:


Anonymous said...

Hi there, any particular reason you do a remove before the mapping?

Bart Wullems said...

Yes, you cannot add the same mapping twice. As a precaution, I remove the mapping first. This will override any configuration at a higher level(if it exists).