Web字体不起作用

时间:2013-06-20 14:53:41

标签: appharbor

我的app正在返回:

Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://fitness-2.apphb.com/Assets/font/artill_clean_icons-webfont.woff
Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://fitness-2.apphb.com/Assets/font/artill_clean_icons-webfont.ttf
Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://fitness-2.apphb.com/Assets/font/rtill_clean_icons-webfont.svg#artill_clean_weather_iconsRg

我的网络配置有:

<staticContent>
      <mimeMap fileExtension=".otf" mimeType="font/otf" />
      <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
      <remove fileExtension=".woff"/>
      <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
    </staticContent>

我在/Assets/font/artill_clean_icons-webfont.woff的文件有:

Build Action: Content

我的/Assets/CSS/文件夹中的CSS文件工作正常,所以我知道它与Assets文件夹无关,而是与字体文件本身有关?

我也下载了版本,字体就在那里。

部署了最新版本,我在这里缺少什么?

1 个答案:

答案 0 :(得分:4)

好的,我为MVC 4项目采取了这个过程:

我将每个字体设置为'Content' - 右键单击​​字体文件,属性并设置Build Action to Content.

我也包含在我的web.config中:

<staticContent>
      <remove fileExtension=".eot" />
      <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
      <remove fileExtension=".ttf" />
      <mimeMap fileExtension=".ttf" mimeType="font/ttf" />
      <remove fileExtension=".otf" />
      <mimeMap fileExtension=".otf" mimeType="font/otf" />
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
    </staticContent>

在System.WebServer部分。