【发布时间】:2015-10-17 09:47:06
【问题描述】:
我有一些内容(图像、字体等)的 Web 应用程序。我试图查看它在发布模式下的工作方式,所有布局崩溃导致字体和图像“未找到”。
什么可能导致此行为以及如何解决?
我发现了什么 - 我的图像在文件夹 Content/images/ 中。在调试模式下,应用程序通过该路径查找图像,但在发布模式下,它会跳过文件夹 Content/ 并尝试查找 images/。
body {
margin: 0 auto;
font-family: Arial;
font-size: 12px;
background: url(images/main_bg.jpg) repeat center top fixed;
background-size: 100%;
vertical-align: top;
font-weight: normal;
}
这就是我在 CSS 中使用图像的方式
bundles.Add(
new StyleBundle("~/layout-styleNew")
.Include("~/Content/bootstrap/css/*.css")
.Include("~/Content/bootstrap/flatly/*.css")
.Include("~/Content/helpful.css")
.Include("~/Content/styleNew.css")
.Include("~/Content/css/ToastMsg/css/*.css")
.Include("~/Content/css/jquery-ui/*.css"));
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@this.ViewBag.Title</title>
@Scripts.Render("~/layout")
@Styles.Render("~/layout-styleNew")
@RenderSection("head", false)
</head>
【问题讨论】:
-
请包含应该包含这些资源的代码..
-
或者给我们演示/站点的链接,我们可以在这里检查这个问题。
-
@Leothelion,目前没有演示站点存在:(
-
没有。不是资源:您如何将它们包含在 HTML 输出中(因此您的 WebForm/Razor/Html 代码)。
-
@Richard,我将此 css 文件添加到包中并将其包含在 _Layout.cshtml 中
标签: css asp.net-mvc bundle