2

ここに私のバンドルがあります:

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>

それでも同じエラーが発生します。

不明な点があればお知らせください。詳しく説明します。ありがとう

4

1 に答える 1

0

アプリケーションに Bundle フォルダーは存在しますか?

試す:

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

デバッグ時に MVC CSS が Visual Studio でレンダリングされない

于 2013-09-19T12:04:45.077 に答える