ここに私のバンドルがあります:
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
同様の質問がここで尋ねられました: CSS バンドルが、bin デプロイされた MVC4 アプリで機能しないのはなぜですか?
参照した質問で提案されているように、この構成をweb.configファイルに追加しようとしました
<modules runAllManagedModulesForAllRequests="true">
<remove name="BundleModule" />
<add name="BundleModule" type="System.Web.Optimization.BundleModule" />
</modules>
それでも同じエラーが発生します。
不明な点があればお知らせください。詳しく説明します。ありがとう