[英]CSS not showing on ASP.Net MVC4 during Visual Studio 2012 Debug
When I debug my site the CSS does not show. 当我调试网站时,CSS不显示。 I get an Error 500 on the Site.css when I inspect it in Firefox. 在Firefox中检查它时,Site.css上显示错误500。
My _Layout.cshtml is set to use the css files. 我的_Layout.cshtml设置为使用css文件。
@Styles.Render("~/Content/css")
I did verify the Site.css file is in the correct folder and I can open it directly using Notepad. 我确实确认Site.css文件在正确的文件夹中,并且可以使用记事本直接打开它。
I have looked at BundleConfig.cs and I see where it's bundled with the other files. 我查看了BundleConfig.cs,然后看到它与其他文件捆绑在一起的位置。
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
}
the really odd part is I do have this setup on IIS7.5 and the css works, but the background image does not. 真正奇怪的部分是我确实在IIS7.5上进行了此设置,并且CSS可以工作,但是背景图像却没有。 We are getting error 500 on it also. 我们也收到错误500。 The IIS_Users does have the rights to access those files. IIS_Users确实有权访问这些文件。
The last problem is that any images are not showing on the site. 最后一个问题是网站上没有显示任何图像。 On the css the background is set like 在css上,背景设置为
background: url("../Images/heroAccent.png") no-repeat; 背景:url(“ ../ Images / heroAccent.png”)不重复;
The Images directory is under the same directory as Views/Models/Controllers etc. Images目录与Views / Models / Controllers等位于同一目录下。
These errors raise for mvc bundling features in css having image path absolute. 这些错误会导致具有图像路径绝对值的css中的mvc捆绑功能。 here are two ways resolved the error 这是解决错误的两种方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.