C# 红隼+;nginx间歇502

C# 红隼+;nginx间歇502,c#,nginx,asp.net-core,kestrel-http-server,C#,Nginx,Asp.net Core,Kestrel Http Server,我有一个ASP.NET core 1.0应用程序在ubuntu 16.04上运行,位于nginx/1.10.0后面。但是,我注意到nginx间歇性地抛出以下错误(在nginx错误日志中) 这可能是nginx配置问题还是ASP.NET/Kestrel问题?有人能给我一些提示来调试这个吗 进一步说明: 在请求完成后,我还在应用程序日志中看到以下内容 2017-06-08 05:19:14.399 [DBG] Executed action method "<Controller.Action&

我有一个ASP.NET core 1.0应用程序在ubuntu 16.04上运行,位于
nginx/1.10.0
后面。但是,我注意到nginx间歇性地抛出以下错误(在nginx错误日志中)

这可能是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

在您的.NET应用程序中,您是否使用
async
/
wait
来处理IO之类的东西?是否有任何任务是您启动后从不等待的?早期关闭连接的一个潜在原因可能是框架假设您完成并关闭请求管道,尽管仍有异步操作在运行。如果这些异步操作所依赖的资源被释放,它们将崩溃,但由于没有等待者,因此没有任何地方可以报告。谢谢@TomasLycken。是的,我确实使用了
async/await
但没有任何
任务
我没有
await
我使用相同的设置遇到了相同的问题。不过我用的是Nancy而不是MVC。我的设置工作正常至少一个月,然后昨天晚上突然停止工作
2017-06-08 05:19:14.399 [DBG] Executed action method "<Controller.Action>", returned result "Microsoft.AspNetCore.Mvc.CreatedAtRouteResult
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
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