Windows天蓝色的CSS和图像

时间:2014-10-29 22:13:20

标签: azure model-view-controller bundle

enter image description here项目在MVC5上完成,当我通过visual studio在azure上发布项目时,无法完成图像和CSS效果。我确实尝试过Bundling.config但仍然无法完成它。我在内容中有一个img文件夹(它包含所有图像)。

我的捆绑配置文件中有以下内容:

bundles.Add(new StyleBundle("~/Content/img").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/site.css",
                      "~/Content/base.css",
                      "~/Content/parallaxstyle.css",
                      "~/Content/bootstrap.css",
                     "~/Content/pricing.css",
                     "~/Content/pricing2.css"));

并在视野中:

@Scripts.Render("~/Content/img")

但它甚至不能渲染css文件。

这是根。 布局视图:

<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/css")

    @Styles.Render("~/Content/img/demo/_small")
    @Scripts.Render("~/bundles/modernizr")
    @Styles.Render("~/Content/bootstrap.css")
    @Styles.Render("~/Content/base.css")
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Josefin+Slab">
    <link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>

</head>
<body>

1 个答案:

答案 0 :(得分:1)

那是因为您创建了StyleBundle,并且正在尝试呈现ScriptBundle

改变这个:

@Scripts.Render("~/Content/img")

对此:

@Styles.Render("~/Content/img")

请注意,如果您在~/Content/img有一个实际文件夹,请考虑更改捆绑包的名称,以便没有名称冲突。