【发布时间】:2017-09-20 09:16:57
【问题描述】:
我有一个 ASP.Net MVC5 应用程序,从一个示例应用程序开始。 当我在发布模式下部署它时,我得到了
HTTP404: NOT FOUND - 服务器没有找到与请求的 URI(统一资源标识符)匹配的任何内容。 获取 - https://SERVER/Content/fonts/glyphicons-halflings-regular.woff2
那不是字体所在的位置。如果我去https://SERVER/fonts/glyphicons-halflings-regular.woff2 我可以下载文件就好了,所以这不是 IIS mimeType 问题。
编辑:通过从我的 Web.config 中删除 debug="true" 可在本地重现
我在我的应用程序中找不到任何配置,没有 BundleConfig,什么都没有指定在哪里找到字体。如何在发布模式下解决此问题?
编辑:这是我的 BundleConfig
public class BundleConfig
{
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/customjs").Include(
"~/Scripts/Custom/btn-number-{version}.js",
"~/Scripts/Custom/input-number-{version}.js",
"~/Scripts/Custom/PriceList/tax-calculation-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new ScriptBundle("~/bundles/charts").Include(
"~/Scripts/Chart.js"));
// Bundle CSS for public part of the site
bundles.Add(new StyleBundle("~/Content/Public/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
// Bundle CSS for dashboard and other actions, when user is logged in
bundles.Add(new StyleBundle("~/Content/Dashboard/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css",
"~/Content/dashboard.css"));
}
}
编辑:以及 bootstrap.css 的字体部分
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
【问题讨论】:
-
我认为这是捆绑或
srcin@font-face的 css 的问题。从您的bootstrap.css分享您的BundleConfig.cs和字体部分
标签: asp.net-mvc twitter-bootstrap-3