Open Closed

Health Checks with Docker #2247


User avatar
0
AlderCove created
  • Version: 4.4.4
  • UI: Angular
  • DB: EF Core
  • Stack trace: When I run the application based on the Application template in Docker, I get an exception with the GetHealthReport.

2021-12-06 19:15:19.798 +00:00 [INF] Start processing HTTP request GET "http://[::]/health-status" 2021-12-06 19:15:19.798 +00:00 [INF] Sending HTTP request GET "http://[::]/health-status" 2021-12-06 19:15:19.809 +00:00 [ERR] GetHealthReport threw an exception when trying to get report from /health-status configured with name Portal Health Status. System.Net.Http.HttpRequestException: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses that cannot be used as a target address. (Parameter 'hostName') ([::]:80) ---> System.ArgumentException: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses that cannot be used as a target address. (Parameter 'hostName') at System.Net.Dns.GetHostEntryOrAddressesCoreAsync(String hostName, Boolean justReturnParsedIp, Boolean throwOnIIPAny, Boolean justAddresses) at System.Net.Dns.BeginGetHostAddresses(String hostNameOrAddress, AsyncCallback requestCallback, Object state) at System.Net.Sockets.MultipleConnectAsync.StartConnectAsync(SocketAsyncEventArgs args, DnsEndPoint endPoint) at System.Net.Sockets.Socket.ConnectAsync(SocketAsyncEventArgs e, Boolean userSocket) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ConnectAsync(Socket socket) at System.Net.Sockets.Socket.ConnectAsync(EndPoint remoteEP, CancellationToken cancellationToken) at System.Net.Sockets.SocketTaskExtensions.ConnectAsync(Socket socket, EndPoint remoteEP, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.DefaultConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken) at System.Net.Http.ConnectHelper.ConnectAsync(Func3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.ConnectAsync(Func3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken) at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReport(HealthCheckConfiguration configuration) i

The health checks UI shows this status:

I can configure another health check in the appconfig, which works OK:

appconfig.json settings:

"HealthChecksUI": { "HealthChecks": [ { "Name": "Portal Health Status AppSettings Config", "Uri": "http://localhost:80/health-status" } ], "EvaluationTimeOnSeconds": 10, "MinimumSecondsBetweenFailureNotifications": 60 }

application Log:

2021-12-06 20:36:17.126 +00:00 [INF] Executing endpoint 'HealthChecks UI Api' 2021-12-06 20:36:17.128 +00:00 [INF] Executed endpoint 'HealthChecks UI Api' 2021-12-06 20:36:17.128 +00:00 [INF] Request finished HTTP/1.1 GET http://localhost:8080/health-api - - - 200 - application/json 10.1569ms 2021-12-06 20:36:20.024 +00:00 [INF] Start processing HTTP request GET "http://localhost/health-status" 2021-12-06 20:36:20.024 +00:00 [INF] Sending HTTP request GET "http://localhost/health-status" 2021-12-06 20:36:20.025 +00:00 [INF] Request starting HTTP/1.1 GET http://localhost/health-status - - 2021-12-06 20:36:20.028 +00:00 [INF] Executing endpoint 'Health checks' 2021-12-06 20:36:20.030 +00:00 [INF] Executed endpoint 'Health checks' 2021-12-06 20:36:20.031 +00:00 [INF] Received HTTP response headers after 7.0253ms - 200 2021-12-06 20:36:20.031 +00:00 [INF] End processing HTTP request after 7.1096ms - 200

I use docker compose to deploy the app locally to docker

`version: '3.8'

services: portal_web_svr: container_name: portal_web_dev
image: aldercovempn.azurecr.io/acs/portal_web_dev networks: - cts_portal_network volumes: - ./default.conf:/etc/nginx/conf.d/default.conf:z ports: - "4200:4200" depends_on: - portal_api_svr

portal_api_svr: container_name: portal_api_dev image: aldercovempn.azurecr.io/acs/portal_api_dev networks: - cts_portal_network environment: - ASPNETCORE_ENVIRONMENT=Production - ConnectionStrings__Default=Server=host.docker.internal;Database=Acs_Portal;User id=docker; Password=dockertime; volumes: - ./Host-Logs:/app/Logs - ./App_Data:/app/App_Data:z - ./appsettings.json:/app/appsettings.json:z ports: - "44360:44360" - "44307:44307" - "8080:80" links: - redis

redis: container_name: portal_redis # Container name image: redis networks: - cts_portal_network

networks: cts_portal_network: `


2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you check https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues?q=+IPv4+address+

  • User Avatar
    0
    AlderCove created

    thank you

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11