【问题标题】:bootstrap - Failed to load resourcebootstrap - 无法加载资源
【发布时间】:2017-05-12 01:45:57
【问题描述】:

我有一个 aspnet mvc 应用程序我的引导包无法在浏览器中加载

BundlesConfig

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));
...
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                    "~/Scripts/modernizr-*"));

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                  "~/Scripts/bootstrap.js",
                  "~/Scripts/respond.js", 
                  "~/Scripts/bootstrap-multiselect.js"));

_Layout.cshtml

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>@ViewBag.Title - My ASP.NET Application</title>
 @Scripts.Render("~/bundles/jquery")

 @Scripts.Render("~/bundles/modernizr")
 </head>
<body>
    <div> ... <div>
     @Scripts.Render("~/bundles/bootstrap")
     @RenderSection("scripts", required: false)
</body>
</html>

现在当我加载页面视图源时说

<script src="/Home/~bundles/bootstrap"></script> Failed to load resource

为什么找到所有其他脚本的地址都错误

【问题讨论】:

    标签: javascript asp.net-mvc twitter-bootstrap bundles


    【解决方案1】:

    在下面的链接中,gone coding user提到的答案,已经清楚地解释了我们可以采取哪些方法来避免这个错误。

    MVC Bundling - Failed to load resource

    请看一下,让我知道这是否解决了您的问题。

    谢谢 卡提克

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-24
      • 2014-03-26
      • 2019-07-13
      • 2017-05-02
      • 2017-12-11
      • 1970-01-01
      相关资源
      最近更新 更多