gpt4 book ai didi

c# - AngularJS 和 Bootstrap 在 IIS 7.5 中部署后无法正确呈现

转载 作者:太空宇宙 更新时间:2023-11-03 15:53:58 25 4
gpt4 key购买 nike

我的项目遇到了奇怪的行为。该网站正在使用 ASP.NET MVC 5Bootstrap 3.2.0AngularJS 1.2.18

在我的开发机器中,我在以下浏览器上测试了我的网站:

  • Firefox 30(工作正常)
  • Internet Explorer 9(工作正常)
  • Internet Explorer 11(工作正常)

但是当我将它部署到运行 IIS 7.5 的不同服务器上时,只有 Firefox 可以正确呈现:

  • Firefox 30(工作正常)
  • Internet Explorer 9(bootstrap 不工作,angularjs 不绑定(bind))
  • Internet Explorer 11(bootstrap 不工作,angularjs 不绑定(bind))

知道为什么它只适用于我的开发机器吗?和IIS上的配置有关系吗?如果这个问题需要改进,请让我知道需要包含的重要细节。

更新 1

这是 VS 中的文件:

enter image description here

BundleConfig.cs 中的完整代码

    public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/angularjs").Include(
"~/Scripts/angular.js"));

bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));

bundles.Add(new ScriptBundle("~/bundles/bootstrapjs").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));

bundles.Add(new StyleBundle("~/Content/normalizeBundle").Include(
"~/Content/normalize.css"));

bundles.Add(new StyleBundle("~/Content/bootstrapBundle").Include(
"~/Content/bootstrap.css",
"~/Content/cerulean-bootstrap-theme.css"));

bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/site.css"));
}

/Views/Shared/_Layout.cshtml

<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - IODashboard</title>
@Styles.Render("~/Content/normalizeBundle")
@Styles.Render("~/Content/bootstrapBundle")
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>

@* more lines here *@

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/angularjs")
@Scripts.Render("~/bundles/bootstrapjs")
@RenderSection("scripts", required: false)
</body>
</html>

最佳答案

@RenderSection("scripts", required: false)

应该是

@RenderSection("Scripts", required: false)

Scripts 标签区分大小写。

关于c# - AngularJS 和 Bootstrap 在 IIS 7.5 中部署后无法正确呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24522829/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com