Bundling with MVC4 not working after I publish to azure

前端 未结 9 2192
闹比i
闹比i 2021-02-08 14:52

Hi I am trying to bundle my scripts for my application. My debug is working and if I publish with the Web.debug every thing works fine. But when I publish with the Web.releas my

9条回答
  •  被撕碎了的回忆
    2021-02-08 15:16

    In BundleConfig.cs I had the following:

            bundles.Add(new StyleBundle("~/Content/css").Include(
                "~/Content/css/bootstrap.css",
                "~/Content/css/bootstrap-responsive.css",
                "~/Content/css/site.css"));
    

    I really actually had to use:

    bundles.Add(new StyleBundle("~/Styles/css").Include(
                "~/Content/css/bootstrap.css",
                "~/Content/css/bootstrap-responsive.css",
                "~/Content/css/site.css"));
    

    I also had to update the reference to my CSS Style bundle in _Layout.cshtml

    @Styles.Render("~/Styles/css")
    

    I found this answer here: http://thebeardeveloper.blogspot.com.au/2013/02/403-forbidden-for-css-bundles-in-asp.html

提交回复
热议问题