这可能是什么原因造成的?我正在使用在本地构建和运行的 DurandalJS 项目。当我尝试部署到 Azure 网站时,应用程序发布但在浏览器中失败:
加载资源失败:服务器响应状态为 404(未找到) http://appsite.azurewebsites.net/Scripts/vendor.js?v=KJCisWMhJYMzhLi_jWQXizLj9vHeNGfm_1c-uTOfBOM1
我没有定制任何捆绑。
我的捆绑配置:
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
}
}
DurandalBundleConfig:
public class DurandalBundleConfig {
public static void RegisterBundles(BundleCollection bundles) {
bundles.IgnoreList.Clear();
AddDefaultIgnorePatterns(bundles.IgnoreList);
bundles.Add(
new ScriptBundle("~/Scripts/vendor.js")
.Include("~/Scripts/jquery-{version}.js")
.Include("~/Scripts/jquery-ui-{version}.js")
.Include("~/Scripts/bootstrap.js")
.Include("~/Scripts/knockout-{version}.js")
.Include("~/Scripts/knockout.mapping-latest.js")
.Include("~/Scripts/isotope.js")
.Include("~/Scripts/toastr.js")
.Include("~/Scripts/tag-it.js")
);
bundles.Add(
new StyleBundle("~/Content/css")
.Include("~/Content/ie10mobile.css")
.Include("~/Content/app.css")
.Include("~/Content/bootstrap.min.css")
.Include("~/Content/bootstrap-responsive.min.css")
.Include("~/Content/font-awesome.min.css")
.Include("~/Content/durandal.css")
.Include("~/Content/starterkit.css")
.Include("~/Content/toastr.css")
.Include("~/Content/tag-it.css")
.Include("~/Content/zen-theme.css")
);
}
public static void AddDefaultIgnorePatterns(IgnoreList ignoreList) {
if(ignoreList == null) {
throw new ArgumentNullException("ignoreList");
}
ignoreList.Ignore("*.intellisense.js");
ignoreList.Ignore("*-vsdoc.js");
ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
//ignoreList.Ignore("*.min.js", OptimizationMode.WhenDisabled);
//ignoreList.Ignore("*.min.css", OptimizationMode.WhenDisabled);
}
}
在我的 html 页面中,我使用这个:
@Scripts.Render("~/Scripts/vendor.js")
这会阻止加载所需的库(如淘汰赛)。可能是我的 web.comfig 中的某些内容吗?任何提示都会很棒。
更新:
如果我执行以下操作,我可以在本地重现确切的问题:
new ScriptBundle("~/Scripts/vvendor.js") // change the virtual output directory here
我认为这意味着视图由于某种原因在发布时找不到目录...