2017-03-03 67 views

回答

2

只要定义字体的文件扩展名将此代码添加到web.config文件

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

你应该注册MIME类型在部署服务器上的字体,使用的web.config这样做:

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

注意:我添加一个remove标签只是为了确保,因为如果type被注册,它会引发错误。 另外,如果您使用的是MVC,请检查您的资源包,因为部署发行版应用程序会混淆资源的路径。

相关问题