I have a simple MVC ASP.Net application with a health check. The check is routed using an attribute: [HttpGet("health")]
我有一个简单的MVC ASP.Net应用程序与健康检查。使用以下属性路由检查:[HttpGet(“health”)]
When running it locally, I browse http://localhost:7000/health
and get a successful result back. The logs look like this:
在本地运行时,我浏览http:// localhost:7000 / health并获得成功的结果。日志看起来像这样:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
[00:00:34.796]: Request starting HTTP/1.1 GET http://localhost:7000/health
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: [00:00:34.796]: Request starting HTTP/1.1 GET http://localhost:7000/health
dbug: Microsoft.AspNetCore.Routing.Tree.TreeRouter[1]
Request successfully matched the route with name '(null)' and template 'health'.
However, once I deploy to Amazon Elastic Beanstalk, none of my normal request work. If I browse http://(myAppName).us-east-2.elasticbeanstalk.com/
these are the logs I get:
但是,一旦我部署到Amazon Elastic Beanstalk,我的正常请求都无法正常工作。如果我浏览http://(myAppName).us-east-2.elasticbeanstalk.com /这些是我得到的日志:
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
[23:56:39.079]: Request starting HTTP/1.1 GET http://172.31.27.29//(myAppName).us-east-2.elasticbeanstalk.com/health
[40m[37mdbug[39m[22m[49m: Microsoft.AspNetCore.Builder.RouterMiddleware[1]
Request did not match any routes.
Note how for some reason the request URL gets an IP address stuck in there. No idea where its coming from.
请注意,由于某种原因,请求URL会在其中粘贴IP地址。不知道它的来源。
1 个解决方案
#1
0
Turns out this was a misconfiguration in AWS. I had set the health check URL with an absolute address, which failed. Then when I tried to health check manually, the load balancer didn't let me through because the AWS health check was failing.
事实证明这是AWS中的错误配置。我已使用绝对地址设置了运行状况检查URL,但该地址失败。然后当我尝试手动进行运行状况检查时,负载均衡器没有让我通过,因为AWS运行状况检查失败了。
I thought the logs were from my manual check, so I assumed that amazon was adding weird things to my request. But really it was just a misconfigured health check in AWS.
我认为日志来自我的手动检查,所以我认为亚马逊在我的请求中添加了奇怪的东西。但实际上,这只是AWS中错误配置的运行状况检查。
#1
0
Turns out this was a misconfiguration in AWS. I had set the health check URL with an absolute address, which failed. Then when I tried to health check manually, the load balancer didn't let me through because the AWS health check was failing.
事实证明这是AWS中的错误配置。我已使用绝对地址设置了运行状况检查URL,但该地址失败。然后当我尝试手动进行运行状况检查时,负载均衡器没有让我通过,因为AWS运行状况检查失败了。
I thought the logs were from my manual check, so I assumed that amazon was adding weird things to my request. But really it was just a misconfigured health check in AWS.
我认为日志来自我的手动检查,所以我认为亚马逊在我的请求中添加了奇怪的东西。但实际上,这只是AWS中错误配置的运行状况检查。