【问题标题】:Bootstrap glyphicons are showing as question mark after hosting on IIS在 IIS 上托管后,引导字形图标显示为问号
【发布时间】:2017-11-14 16:36:53
【问题描述】:

我在我的 Asp.Net MVC5 网络应用程序中使用引导字形图标, 它在本地系统上显示良好,但在服务器上发布后,所有字形图标要么是方形框,要么是问号。
检查网络元素后,我收到两个与 glyphicons-halflings-regular.woff 文件相关的错误,但我不知道它是什么意思以及如何纠正它

更新 1。]

【问题讨论】:

  • 检查您的文档以在生产期间访问静态文件。反之,可以使用CDNs;并将您的请求从 http 更改为 https
  • 你能确保你所有的 .woff 文件也被部署了吗?
  • 路径不正确
  • 当您尝试从屏幕截图中的 GET 请求中看到的确切 URL 访问“woff”文件时会发生什么?问题出在路径上,或者存在与访问相关的问题。当应用程序在 IIS 或生产服务器中运行时,它在不同用户(主要是应用程序池用户,除非另有说明)的上下文中运行。检查文件夹的访问权限也是值得的。
  • @nirman,ttf 文件显示字体但 woff 文件未显示预览,请检查我更新的问题,ttf 和 woff 它们都在同一个文件夹中。如果在该文件夹中可以访问 ttf,那么 woff 怎么会有访问相关问题

标签: asp.net-mvc twitter-bootstrap


【解决方案1】:

添加

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

对于WOFF 2.0

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

在您的 web.config 文件中。

【讨论】:

  • 不,亲爱的,什么都没有发生
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-06-10
  • 2017-01-29
  • 2012-07-12
相关资源
最近更新 更多