2017-04-08 73 views
0

我正在使用IIS Express和我制作的ASP.NET Core应用程序。在我最近的变更集中,我开始在客户端获得如何确定500错误的原因

Failed to load resource: the server responded with a status of 500 (Internal Server Error) 

。我在事件查看器can'd什么和服务器日志不会真的给我任何有用的信息,无论是

#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

@{ 
    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> 

注释掉@Url.Content("~/js/tutorial.jsx")我changeset是https://github.com/jamkin/archivedash/commit/6bde62f9c85d3e8b0e32d1fb83e5737f91050e0e,对我来说它在那之前工作。

我已经通过Startup.cs并通过我的控制器进行了调试(当我访问该页面时会得到实例化)并且没有例外。

有人可以帮我指出问题的方向吗?

+0

它的一些服务器端错误(以500代码所示)。我没有足够的信息从你发布的信息中获得更多信息。我建议向服务器添加更多日志记录,以查看其失败的位置。 –

+0

这并不能解决您的问题,但您应该真正使用MVC Core为您提供的内置依赖注入框架。 – DavidG

+0

哦,既然你是在MVC核心,考虑包括你的Javascript文件,像这样'' – DavidG

回答

0

由于错误“无法加载资源:服务器响应状态为500(内部服务器错误)”来自客户端,您是否能够查看开发人员工具栏网络选项卡以查看详细错误服务器响应。

在粘贴的IIS日志中,我看不到500响应状态。由于您正在使用本地主机(从iis日志中找到它),服务器应该发送详细的错误响应以及堆栈和其他详细信息。希望你有你已经启用了您的配置方法增加开发商的异常页面解释here

if (env.IsDevelopment()) 
    { 
     app.UseDeveloperExceptionPage(); 
    } 

在您的客户端,您可以Checkout开发人员工具栏 - >网络标签 - >点击500错误 dev toolbar response in IE

你可以看到IE/Chrome浏览器/火狐类似的反应细节等

相关问题