Add MIME mapping in web.config for IIS Express Add MIME mapping in web.config for IIS Express asp.net asp.net

Add MIME mapping in web.config for IIS Express


Putting it in the "web.config" works fine. The problem was that I got the MIME type wrong. Instead of font/x-woff or font/x-font-woff it must be 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 anybody encounters this with errors like Error: cannot add duplicate collection entry of type ‘mimeMap’ with unique key attribute and/or other scripts stop working when doing this fix, it might help to remove it first like this:

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

At least that solved my problem


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