2017-03-03 68 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,請檢查您的資源包,因爲部署發行版應用程序會混淆資源的路徑。

相關問題