如何删除有关 glyphicons-halflings-regular.woff2 未找到的错误 [英] How to remove error about glyphicons-halflings-regular.woff2 not found
问题描述
ASP.NET MVC4 Bootstrap 3 应用程序从 Microsoft Visual Studio Express 2013 for Web IDE 运行.
ASP.NET MVC4 Bootstrap 3 application is running from Microsoft Visual Studio Express 2013 for Web IDE.
Chrome 控制台总是显示错误
Chrome console shows always error
http://localhost:52216/admin/fonts/glyphicons-halflings-regular.woff2
Failed to load resource: the server responded with a status of 404 (Not Found)
该文件存在于解决方案资源管理器的字体目录中.构建操作设置为内容",复制到输出目录为不要像其他字体文件一样复制".使用 NuGet 将 Bootstrap 3 添加到解决方案中.如何解决此问题,以免发生此错误?应用程序正确显示 Glyphicon 和 FontAwesome 图标.此错误总是在应用程序启动时发生.
This file exists in the fonts directory in the Solution Explorer. Build action is set to "Content" and Copy to Output directory is "Do not copy like in other font files". Bootstrap 3 is added to the solution using NuGet. How to fix this so that this error does not occur? Application shows Glyphicon and FontAwesome icons properly. This error always occurs at application startup.
推荐答案
出现这个问题是因为 IIS 不知道 woff
并且woff2
文件 MIME 类型.
This problem happens because IIS does not know about woff
and
woff2
file mime types.
解决方案 1:
在您的 web.config 项目中添加这些行:
Add these lines in your web.config project:
<system.webServer>
...
</modules>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
</staticContent>
解决方案 2:
在 IIS 项目页面上:
On IIS project page:
步骤 1: 转到您的项目 IIS 主页并双击 MIME 类型
按钮:
Step 1: Go to your project IIS home page and double click on MIME Types
button:
第 2 步:点击 Actions
菜单中的 Add
按钮:
Step 2: Click on Add
button from Actions
menu:
步骤 3: 在屏幕中间出现一个窗口,您需要在该窗口中添加解决方案 1 中的两行:
Step 3: In the middle of the screen appears a window and in this window you need to add the two lines from solution 1:
这篇关于如何删除有关 glyphicons-halflings-regular.woff2 未找到的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!