Workaround for IIS Unable to load font files (*.woff,*.svg)

Source: Internet
Author: User

In the process of writing the front-end code, you often encounter the use of a specific font (*.WOFF,*.SVG), at which time the request is returned when the font is loaded

Failed to load Resource:the Server responded with a status of 404 (not Found).

The reason is that, by default, there is no MIME type added to the *.woff,*.svg file on IIS, so when the client requests such a file, it gets 404.

So we just need to add the type of the file to the MIME type under our corresponding website.

    1. . Woff Application/x-font-woff
    2. . woff2 Application/x-font-woff
    3. . svg Image/svg+xml

In addition, in MVC, when you set the above MIME type, the GET request font will appear with a 404 problem, this time we need to add the following code to the system.webserver node of config in our web project to support

<staticContent>
<remove FileExtension=". Woff"/>
<mimemap FileExtension=". Woff" MimeType="Application/x-font-woff" />
<remove FileExtension=". Woff2"/>
<mimemap FileExtension=". Woff2" MimeType="Application/x-font-woff2" />
<remove FileExtension=". TTF" />
<mimemap FileExtension=". TTF" MimeType="Application/x-font-truetype" />
<remove FileExtension=". svg" />
<mimemap FileExtension=". svg" MimeType="Image/svg+xml" />
<remove FileExtension=". OTf" />
<mimemap FileExtension= mimetype= />
       <remove fileextension=< Span class= "ATV" > "EOT" />
       <mimemap fileextension= "EOT" mimetype= />
</STATICCONTENT>

IIS cannot load a font file (*.woff,*.svg) workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.