Troubleshoot Web deployment svg/woff/woff2 font 404 errors

Source: Internet
Author: User

After the Web site is published to IIS, you find that the Woff font referenced by the bootstrap framework used by the Web site does not display properly. The HTTP request was tracked and the Woff font request was found to have a get. Woff 404 (not Found) problem, but the file for Woff fonts in the project was not lost. After troubleshooting, IIS did not add the MIME type of the Woff font on the server, causing IIS to be unable to process and recognize files of this type when sending an HTTP request.

Workaround 1: Add the MIME type of the Woff font to the Web. config configuration file

Liberation Method 2: Add MIME types for Woff fonts in IIS
Woff Font Introduction
Introduction to MIME Types

Workaround One: Add the MIME type of the Woff font to the Web. config configuration file

If the Web site is written using ASP. NET or ASP, you can easily configure the Woff font directly using the configuration file. Just add the following configuration to the System.webserver node in Web. config.

<system.webServer>  <staticContent>  <remove fileextension= ". Woff"/>  <mimemap Fileextension= ". Woff" mimetype= "Font/x-font-woff"/>   </staticContent> </system.webServer>

Note here that this configuration, adding this node is to prevent this error: "When the unique key property" FileExtension "is set to". Woff ", you cannot add a duplicate collection item of type" MimeMap ", this issue can be viewed by clicking this link to view the workaround. If you add only the following node, and you do not report the error, the Remove node can not be added. Another "Font/x-font-woff" is the MIME type value of the Woff font.

After you add the node to the Web site's profile, the Woff font is displayed correctly when you reopen the Web site. This method can be used as a solution when you do not have permission to manipulate IIS Manager.

Emancipation Program II: Adding MIME types for Woff fonts in IIS

If you can manipulate IIS Manager directly, you can also add the MIME type of the Woff font directly on IIS. Just open the current IIS, open the MIME-type configuration, and finally add a new MIME type, where the Woff font extension is. woff, and the MIME type is: "Font/x-font-woff". The operation is as follows:

Open IIS Manager in Control Panel, select Current IIS, turn on MIME type configuration;

Add the. Woff in IIS;

Click the Add function of the bar to the right of the MIME type;

Adds a MIME type of. Woff;

The Add MIME Type dialog box pops up with the file extension filled in. woff,mime type can be filled with font/x-font-woff or application/x-font-woff;

Set the file name extension and type;

Click OK after successfully added the. woff extension of the Mimi TYPE, now open the Web site request Woff font will not appear 404 Not Found error.

Woff Font Introduction

The Web Open font format (Web open font format, or woff) is a font format standard used by Web pages. This font format, which was developed in 2009, is now being standardized by the web-font Working Group of the WWW Consortium in order to be the recommended standard. This font format not only effectively utilizes compression to reduce file size, it does not contain encryption and is not subject to DRM (digital copyright management) restrictions.

On April 8, 2010, after the Mozilla Foundation, Opera Software, and Microsoft submitted Woff, the World Wide Web Consortium commented that it was hoped that Woff would soon become a "single, interoperable (font) format" supported by all browsers. [6] on July 27, 2010, the World Wide Web Consortium published Woff as a working draft.

Woff MIME type is: Application/x-font-woff (Font/x-font-woff can also), the current IIS7 inside the default does not have this MIME type, if you want to let the site support this, Please add Woff to the MIME type inside the IIS7.

Introduction to MIME Types

MIME (Multipurpose Internet Mail Extensions) Multipurpose Internet Mail Extension type, which sets the type of file for an extension to be opened by an application, when the extension file is accessed, The browser will automatically open with the specified application. Many are used to specify some client-customized file names, as well as some ways to open media files.

file name extension MIME type 

. svg IMAGE/SVG+XMZ

?. Woff Application/x-font-woff

?. WOFF2 Application/x-font-woff

Troubleshoot Web deployment svg/woff/woff2 font 404 errors

Related Article

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.