I need to add a new MIME mapping for .woff file extensions to IIS Express.
If I add the following snippet to the "applicationhost.config" of IIS Express it works fine:
<staticContent lockAttributes="isDocFooterFileName"> <mimeMap fileExtension=".woff" mimeType="font/x-woff" /> ...
But I would actually like to do add it to my "web.config" so that not every developer would need to change their "applicationhost.config" locally.
So I removed it again from the "applicationhost.config" file and added the following snippet to the project's "web.config":
<system.webServer> ... <staticContent> <mimeMap fileExtension=".woff" mimeType="font/x-woff" /> </staticContent> </system.webServer>
Unfortunately it doesn't seem to work that way because when I try to access a .woff file I end up with a HTTP 404.3 error.
What am I doing wrong?
In the Connections pane, go to the site, application, or directory for which you want to add a MIME type. In the Home pane, double-click MIME Types. In the MIME Types pane, click Add... in the Actions pane. In the Add MIME Type dialog box, add the file name extension and MIME type, and then click OK.
Yes, IIS Express uses the same applicationhost. config and web. config files supported by IIS.
Putting it in the "web.config" works fine. The problem was that I got the MIME type wrong. Instead of or font/x-woff
it must be font/x-font-woff
application/font-woff
:
<system.webServer> ... <staticContent> <remove fileExtension=".woff" /> <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> </staticContent> </system.webServer>
See also this answer regarding the MIME type: https://stackoverflow.com/a/5142316/135441
Update 4/10/2013
Spec is now a recommendation and the MIME type is officially:
application/font-woff
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With