我正在使用MVC4编写的app ports上运行一个应用程序.
一捆css文件不起作用.在调试模式的本地计算机中,我看到了应用程序的代码,我看到了文件.该应用程序按预期工作.
<link href="/Content/css/home/basic-jquery-slider.css" rel="stylesheet"/>
<link href="/Content/css/home/Home.css" rel="stylesheet"/>
Run Code Online (Sandbox Code Playgroud)
当我将应用程序上传到Appharbor时,我在代码中看到了捆绑包但是App无法正常工作.
<link href="/Content/css/home?v=zhVOIpUNuvCOZhJyBcQWpMlozayor4te6k-pM29wHqI1" rel="stylesheet"/>
Run Code Online (Sandbox Code Playgroud)
当我浏览那个链接时,href我得到403 - 禁止访问:访问被拒绝.
如何解决这个问题?
我正在尝试对一些.css和.js文件使用bundle minification.我的bundle配置如下:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/Modernizr").Include(
"~/Scripts/modernizr.js"
));
bundles.Add(new StyleBundle("~/TemplateContent").Include(
"~/Content/bootstrap.css",
"~/Content/bootstrap-responsive.css",
"~/Content/prettyPhoto.css",
"~/Content/prettify.css",
"~/Content/flexslider.css",
"~/Content/iview.css",
"~/Content/style.css",
"~/Content/default.css"
));
bundles.Add(new StyleBundle("~/AppContent").Include(
"~/Content/bootstrap-tablesorter.css",
"~/Content/animate.css",
"~/Content/font-awesome.css",
"~/Content/jcarousel.css",
"~/Conten/overwrite.css",
"~/Content/sequence.css",
"~/Content/sequence.ie.css",
//more styles
));
bundles.Add(new ScriptBundle("~/TemplateScripts").Include(
"~/Scripts/modernizr-*",
"~/Scripts/jquery.js",
"~/Scripts/raphael.js",
"~/Scripts/jquery.easing.1.3.js",
"~/Scripts/bootstrap.js",
"~/Scripts/google-code-prettify/prettify.js",
"~/Scripts/jquery.elastislide.js",
"~/Scripts/jquery.tweet.js",
"~/Scripts/jquery.prettyPhoto.js",
"~/Scripts/jquery.flexslider.js",
"~/Scripts/iview.js",
"~/Scripts/jquery-hover-effect.js",
"~/Scripts/animate.js",
"~/Scripts/custom.js"
));
bundles.Add(new ScriptBundle("~/AppScripts").Include(
"~/Scripts/jquery.ticker.js",
"~/Scripts/jquery.contenthover.js",
"~/Scripts/jquery-ui-1.10.3.js",
"~/Scripts/datetimepicker.js",
"~/Scripts/jquery.metadata.js",
//more scripts
));
BundleTable.EnableOptimizations = true;
}
Run Code Online (Sandbox Code Playgroud)
当我将应用程序发布到服务器(godaddy共享虚拟主机)时,问题就出现了,我确实得到了一个缩小的输出,但是我在这些输出上得到403错误.
如果我订
BundleTable.EnableOptimizations = false;
Run Code Online (Sandbox Code Playgroud)
文件不会缩小,但页面具有正确的行为.