我在nginx/1.10.0
后面的ubuntu 16.04上运行了一个ASP.NET核心1.0应用程序。但是,我注意到间歇性的nginx会抛出以下错误(在nginx错误日志中)
2017/06/08 05:19:19 [error] 11572#11572: *119049 upstream prematurely closed connection while reading response header from upstream, client: <ipaddress>, server: <servername>, request: "POST /<uri> HTTP/1.1", upstream: "http://127.0.0.1:5000/<uri>", host: "<servername>"
虽然请求在应用程序中成功完成,但导致客户端502 Bad Gateway
2017-06-08 05:19:14.399 [DBG] Executed action method "<Controller.Action>", returned result "Microsoft.AspNetCore.Mvc.CreatedAtRouteResult
这可能是nginx配置问题还是ASP.NET/Kestrel问题?有人可以给我提示调试吗?
补充说明:
我在请求完成后的应用程序日志中也看到以下内容
2017-06-08 05:19:14.399 [DBG] Executed action method "<Controller.Action>", returned result "Microsoft.AspNetCore.Mvc.CreatedAtRouteResult
2017-06-08 05:19:18.632 [DBG] Some connections failed to close gracefully during server shutdown.
2017-06-08 05:19:22.402 [DBG] Hosting starting
2017-06-08 05:19:22.689 [DBG] Hosting started
并且nginx错误大约在同一时间2017/06/08 05:19:19
此外,通常在日志中我会看到Executing ObjectResult
和Executed
时间等消息,我在上述请求中看不到这些消息
2017-06-08 00:10:14.391 [DBG] Selected output formatter '"Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter"' and content type '"application/json"' to write the response.
2017-06-08 00:10:14.391 [INF] Executing ObjectResult, writing value "Microsoft.AspNetCore.Mvc.ControllerContext".
2017-06-08 00:10:14.504 [INF] Executed action "<Controller.Action>" in 1875.3845ms