Deploying net core app to pcf: start app timeout with health check 404 failure

52 Views Asked by At

I have recently migrated a console app from a deprecated target version to Net Core 7. When I deploy it to my Org's pcf server, the app instance won't start with what looks like a health check failure.

0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting

This is what I see in the logs:

2023-12-28T20:21:14.568+01:00 [APP/PROC/WEB/0] [OUT] [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
2023-12-28T20:21:14.568+01:00 [APP/PROC/WEB/0] [OUT] Request finished HTTP/1.1 GET http://10.xxx.xxx.xxx:8080/**health - - - 404 0** - 0.1826ms

My manifest looks like this:

---
applications:
 - name: test-DEV
   health-check-type: http
   health-check-http-endpoint: /health
   buildpack: dicf_dotnet_core_buildpack_latest
   memory: 1GB

I tried increasing the timeout limit, but it does not help. Any idea what could be the issue? Thank you.

1

There are 1 best solutions below

1
Tim On

You're right that the issue is a health check failure. From the app logs, it looks like you have ASP.NET Core web hosting enabled, and requests are making it from the platform to the app, but nothing is listening at /health.

You can add Endpoints/Actuators with Steeltoe or ASP.NET Core Health Checks to get health checks over HTTP, but you may not want to use HTTP health checks for an application that does not actually use HTTP. It's generally recommended to use a process check for those cases. Read more about health check types in Cloud Foundry.

As you've already noted, anything other than a positive result will result in your application being restarted by the platform, so it is in your app's best interest to use a health check that is accurately scoped to the health of the application instance and you probably don't want instances recycled because the db is down.