Twitter bootstrap图标在发布模式下无法显示404
Twitter bootstrap图标在发布模式下无法显示404
我正在一个ASP.NET MVC 4项目中进行工作,我按照以下步骤进行了操作:
- 从http://blog.getbootstrap.com/2013/12/05/bootstrap-3-0-3-released/下载了Twitter Bootstrap。
- 将字体文件的构建操作设置为Content(文件位于~/Content/font文件夹中):
glyphicons-halflings-regular.eot glyphicons-halflings-regular.svg glyphicons-halflings-regular.ttf glyphicons-halflings-regular.woff
- 在RouteConfig.cs中添加了以下内容:
routes.IgnoreRoute("{folder}/{*pathInfo}", new { folder = "Content" });
- 在Web.config中添加了以下元素:
- 在BundleConfig.cs中包含了以下代码:
bundles.Add(new StyleBundle("~/bundles/maincss") .Include("~/Content/bootstrap/bootstrap.css") .Include("~/Content/bootstrap/bootstrap-theme.css") .Include("~/Content/hbl-full.css"));
还尝试了以下代码:
IItemTransform cssFixer = new CssRewriteUrlTransform(); bundles.Add(new StyleBundle("~/bundles/maincss") .Include("~/Content/bootstrap/bootstrap.css", cssFixer) .Include("~/Content/bootstrap/bootstrap-theme.css", cssFixer) .Include("~/Content/hbl-full.css", cssFixer));
- 在主要的Layout.cshtml中调用了以下代码:
@Styles.Render("~/bundles/maincss")
在本地主机中,图标正常显示,但是当我将代码推送到发布服务器时,我只能看到方块而不是图标,并且在Chrome的控制台选项卡中,我得到了以下错误:
GET http://domain.apphb.com/fonts/glyphicons-halflings-regular.woff 404 (Not Found) test:1
GET http://domain.apphb.com/fonts/glyphicons-halflings-regular.ttf 404 (Not Found) test:1
GET http://domain.apphb.com/fonts/glyphicons-halflings-regular.svg 404 (Not Found) test:1
谢谢。