2017-05-12 99 views
1

我有一个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 

为什么给了错误的地址的所有其他脚本中发现

回答

1

在下面的链接,由了编码用户答案提到,已经清楚地解释什么是我们可以做的方式,为避免这个错误。

MVC Bundling - Failed to load resource

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

谢谢 karthik