使用VS’12,Asp.net – C# – InternetApplication Template,KendoUI,EF Code First
这是我的MVC BundleConfig.cs
bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css")); // The Kendo CSS bundle bundles.Add(new StyleBundle("~/Content/kendo").Include( "~/Content/kendo/kendo.common.*","~/Content/kendo/kendo.default.*")); // The Kendo JavaScript bundle// or kendo.all.min.js if you want to use Kendo UI Web and Kendo UI DataViz bundles.Add(new ScriptBundle("~/bundles/kendo").Include( "~/Scripts/kendo/kendo.web.min.js","~/Scripts/kendo/kendo.aspnetmvc.min.js"));
另外你应该知道我在BundleConfig.cs的末尾运行这两行
bundles.IgnoreList.Clear(); bundles.DirectoryFilter.Clear();
当我尝试主办项目时,我已经得到403访问被拒绝,文件禁止错误.
我试图使用This Awesome Post作为参考,在那里我改变了一些事情,但错误仍然发生.
我想认为它是因为KendoUI的.min文件来的,但我不能肯定.
为了您的参考,这是我的_Layout.cshtml,以及我如何调用脚本.
@Scripts.Render("~/bundles/jquery") @Styles.Render("~/Content/css") @Styles.Render("~/Content/kendo") @Scripts.Render("~/bundles/kendo")
解决方法
尝试改变
bundles.Add(new StyleBundle("~/Content/kendo").Include( "~/Content/kendo/kendo.common.*","~/Content/kendo/kendo.default.*"));
至
bundles.Add(new StyleBundle("~/bundles/css/kendo").Include( "~/Content/kendo/kendo.common.*.css","~/Content/kendo/kendo.default.*.css"));
接着
@Styles.Render("~/Content/kendo")
至
@Styles.Render("~/bundles/css/kendo")