【发布时间】:2017-04-08 20:39:31
【问题描述】:
我正在使用 IIS Express 和我制作的 ASP.NET Core 应用程序。在我最近的变更集中,我开始得到
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
在客户端。我可以在事件查看器中做任何事情,服务器日志也没有真正给我任何有用的信息
#Date: 2017-04-08 04:24:20
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-04-08 04:24:20 ::1 DEBUG / - 60372 - ::1 - - 200 0 64 19049
2017-04-08 04:24:28 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 23321
2017-04-08 04:24:30 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 404 0 0 2764
2017-04-08 04:24:49 ::1 GET /comments - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 341
2017-04-08 04:25:02 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 580
2017-04-08 04:25:02 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 404 0 0 1026
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2017-04-08 04:36:21
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-04-08 04:36:21 ::1 DEBUG / - 60372 - ::1 - - 200 0 64 20554
2017-04-08 04:36:30 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 25434
2017-04-08 04:36:34 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 404 0 0 3737
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2017-04-08 04:38:28
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-04-08 04:38:28 ::1 DEBUG / - 60372 - ::1 - - 200 0 64 9241
2017-04-08 04:38:38 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 16824
2017-04-08 04:38:43 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 200 0 0 6067
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2017-04-08 04:41:07
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2017-04-08 04:41:07 ::1 DEBUG / - 60372 - ::1 - - 200 0 64 27826
2017-04-08 04:41:20 ::1 GET / - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 - 200 0 0 38678
2017-04-08 04:41:34 ::1 GET /js/tutorial.jsx - 60372 - ::1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/56.0.2924.87+Safari/537.36 http://localhost:60372/ 200 0 0 12721
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
我发现如果我从Index.cshtml 中注释掉@Url.Content("~/js/tutorial.jsx")
@{
Layout = null;
}
<html>
<head>
<title>LRC Archive Dashboard</title>
</head>
<body>
<div id="content"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/remarkable/1.7.1/remarkable.min.js"></script>
<script src="@Url.Content("~/js/tutorial.jsx")"></script>
</body>
</html>
我的变更集是https://github.com/jamkin/archivedash/commit/6bde62f9c85d3e8b0e32d1fb83e5737f91050e0e,对我来说它在那之前就可以工作。
我已经通过Startup.cs 和我的控制器进行了调试(当我访问页面时它会被实例化)并且没有异常。
有人可以帮我指出问题的方向吗?
【问题讨论】:
-
这是一些服务器端错误(如 500 代码所示)。我没有从您发布的内容中获得足够的信息,无法为您提供比这更好的信息。我建议向服务器添加更多日志记录以查看失败的位置。
-
这并不能解决您的问题,但您确实应该使用 MVC Core 为您提供的内置依赖注入框架。
-
哦,既然您在 MVC Core 中,请考虑包含您的 Javascript 文件,例如
<script src="~/js/tutorial.jsx" asp-append-version="true"></script>
标签: asp.net .net reactjs iis asp.net-core