该网站以前运行良好,但现在未加载脚本文件,样式和图像。 Chrome显示错误,指出无法加载资源:服务器的响应状态为500(内部服务器错误)。这是代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-
toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("StarGSP", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Suspicious Activity", "Index", "Suspicious", new { area = "" }, new { @class = "navbar-brand" })</li>
</ul>
</div>
<div class="">
<ul class="nav navbar-nav">
F
<li>@Html.ActionLink("Trooper Activity", "Index", "Trooper", new { area = "" }, new { @class = "navbar-brand" })</li>
</ul>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Privacy Policy", "Index", "PrivacyPolicy", new { area = "" }, null)</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - StarGSP</p>
</footer>
</div>
@RenderSection("scripts", required: false)
无法加载资源:服务器的状态为500(内部服务器错误)bootstrap.css
答案 0 :(得分:-1)
此问题的解决方案是,引用脚本或文件时,脚本必须位于html文件的底部,文件必须位于html文件的顶部。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
**@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")**
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-
toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@Html.ActionLink("StarGSP", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Suspicious Activity", "Index", "Suspicious", new { area = "" }, new { @class = "navbar-brand" })</li>
</ul>
</div>
<div class="">
<ul class="nav navbar-nav">
F
<li>@Html.ActionLink("Trooper Activity", "Index", "Trooper", new { area = "" }, new { @class = "navbar-brand" })</li>
</ul>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Privacy Policy", "Index", "PrivacyPolicy", new { area = "" }, null)</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - StarGSP</p>
</footer>
</div>
**@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")**
@RenderSection("scripts", required: false)