Reputation: 29331
I'm trying to deploy a web application which references http://fortawesome.github.io/Font-Awesome/
Everything works great locally, but when I deploy I receive several 500 errors.
> GET
> http://localhost/csweb/Content/font_awesome/font/fontawesome-webfont.ttf
> 500 (Internal Server Error)
> GET
> http://localhost/csweb/Content/font_awesome/font/fontawesome-webfont.woff
> 500 (Internal Server Error)
> GET
> http://localhost/csweb/Content/font_awesome/font/fontawesome-webfont.svg#fontawesomregular
> 500 (Internal Server Error)
A quick search of StackOverflow lead me to this thread: Why is @font-face throwing a 404 error on woff files?
as such I added to my web.config file:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
...
I see IIS reflecting these changes after calling iisreset, but no effect was seen on the deployed application.
I'm not finding any other obvious answers -- anyone know anything I don't?
Upvotes: 3
Views: 7131
Reputation: 1
Earlier versions of IIS didn't have a MIME type for WOFF2. So the fonts folder contained a web.config file containing <mimeMap fileExtension=".woff2" mimeType="font/x-woff2" />. Newer versions now have a MIME type for WOFF2 so the web.config file is causing an error, it needs to read <remove fileExtension=".woff2" /> <mimeMap fileExtension=".woff2" mimeType="font/x-woff2" />
Upvotes: 0
Reputation: 726
For my issue, it causes by the web.config file that has <mimeMap fileExtension=".woff" ...> statement in the static font folder. Delete it everything goes well. Also, I tried to add mimeMap statement on the website root folder web.config file but cause the CSS loading error.
Upvotes: 0
Reputation: 29331
Oh hey, I figured it out almost immediately afterward. I need to add the following lines to web.config:
<httpHandlers>
<add verb="GET" path="*.woff" type="System.Web.StaticFileHandler" />
<add verb="GET" path="*.ttf" type="System.Web.StaticFileHandler" />
<add verb="GET" path="*.svg" type="System.Web.StaticFileHandler" />
...
Upvotes: 4