简体   繁体   English

ASP.NET核心偶尔503响应

[英]ASP.NET core occasional 503 response

I have the following setup: 我有以下设置:

  • Framework version: ASP.NET Core 2.1 框架版本:ASP.NET Core 2.1
  • Host machine: Amazon Linux 主机:Amazon Linux
  • Run container: derivative of microsoft/dotnet:2.1-aspnetcore-runtime 运行容器: microsoft/dotnet:2.1-aspnetcore-runtime衍生产品microsoft/dotnet:2.1-aspnetcore-runtime

My application starts up and runs happily, but occasionally fails health checks by returning 503 Unavailable . 我的应用程序启动并愉快地运行,但偶尔会通过返回503 Unavailable失败运行状况检查。 This seems to occur after >= 4 hours of no API requests. 这似乎是在> = 4小时没有API请求之后发生的。 No error logs occur on the server, and the web service does not die or restart during that time - subsequent requests are serviced happily with no interruptions in logs. 服务器上没有错误日志,并且在这段时间内Web服务不会消失或重新启动-后续请求得到了愉快的服务,日志没有中断。

Interestingly, it seems to occur precisely on the minute of the hours after the application was deployed. 有趣的是,它似乎恰好发生在部署应用程序后的数分钟之内。 For instance, the most recent deploy occurred at 11:08AM, and the 503 occurred at 3:08PM. 例如,最近的部署发生在11:08 AM,而503发生在3:08 PM。 This has recurred enough times to be very noticeable. 这已经重复了足够多次,非常明显。

This feels like a JIT caching issue to me (due to lack of restarting and regular intervals of failure), but I can't find any other information about this or others having this problem. 对我来说,这感觉像是一个JIT缓存问题(由于缺少重新启动和定期的故障间隔),但是我找不到有关此问题或其他有此问题的其他信息。

Question : Can you explain what is going on, and how I can keep my web application correctly servicing requests even if none occur for several hours? 问题 :您能解释一下发生了什么吗,即使几个小时都没有发生请求,我又如何使我的Web应用程序正确地为请求提供服务?

Outcome: after a lot of logging and string-pulling, we determined that the problem was not with the dotnet app at all, but rather higher up in the infrastructure. 结果:经过大量的日志记录和字符串抽取后,我们确定问题根本不在dotnet应用程序上,而是在基础架构中更严重。 The bad requests were never reaching the web service at all. 错误的请求根本无法到达Web服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM