以下是我的bundels:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Bootstrap/assets/js/jquery.js"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Bootstrap/assets/js/bootstrap-transition.js",
"~/Bootstrap/assets/js/bootstrap-alert.js",
"~/Bootstrap/assets/js/bootstrap-modal.js",
"~/Bootstrap/assets/js/bootstrap-dropdown.js",
"~/Bootstrap/assets/js/bootstrap-scrollspy.js",
"~/Bootstrap/assets/js/bootstrap-tab.js",
"~/Bootstrap/assets/js/bootstrap-tooltip.js",
"~/Bootstrap/assets/js/bootstrap-popover.js",
"~/Bootstrap/assets/js/bootstrap-button.js",
"~/Bootstrap/assets/js/bootstrap-collapse.js",
"~/Bootstrap/assets/js/bootstrap-carousel.js",
"~/Bootstrap/assets/js/bootstrap-typeahead.js",
"~/Bootstrap/assets/js/bootstrap-affix.js",
"~/Bootstrap/assets/js/application.js",
"~/Bootstrap/assets/js/bootstrap.js"
));
}
下面是我的_Layout页面的部分内容:
@Scripts.Render("~/bundles/bootstrap")
...
当我尝试运行这个应用程序时,我得到类似如下的js错误
An Error has occurred in the script on this page
Object Expected
URL http://servername/AppName/bundles/bootstrap?v=asdjisdjsincdjijadosJISJDIS_idosd
这里也问了一个类似的问题:Why is my CSS bundling not working with a bin deployed MVC4 app?
我尝试按照我引用的问题的建议将此配置添加到我的web.config文件中
<modules runAllManagedModulesForAllRequests="true">
<remove name="BundleModule" />
<add name="BundleModule" type="System.Web.Optimization.BundleModule" />
</modules>
我仍然收到同样的错误。
如果有什么不清楚的地方,请让我知道,我会详细说明。谢谢
发布于 2013-09-19 20:04:45
捆绑文件夹是否存在于您的应用程序中?
尝试:
bundles.Add(new ScriptBundle("~/Bootstrap/assets/js/jquery").Include(
"~/Bootstrap/assets/js/jquery.js"));
bundles.Add(new ScriptBundle("~/Bootstrap/assets/js/bootstrap").Include(
http://www.mvccentral.net/Story/Details/articles/kahanu/stylebundle-403-error-solved
https://stackoverflow.com/questions/17757711
复制相似问题