Open Closed

The Api.Host fails to run locally (due to health-check error) #5730


User avatar
0
akaziuka created
  • ABP Framework version: v7.2.2
  • UI Type: Angular
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: See below
  • Steps to reproduce the issue: Install a solution from template. Rut it (Api.Host locally on Windows 11

To clarify - workstation0912 is my Windows 11 machine name. It's unclear why it resolves to this address if I run the Api.Host locally, instead of https://localhost:44338/health-status, because this is exactly what I have defined in the appconfig.json file. I didn't change the config (except the connection string to a database). Am I missing any sort of configuration for Raider/Visual Studio???

[16:40:55 ERR] GetHealthReport threw an exception when trying to get report from http://WORKSTATION0912/health-status configured with name _3M Health Status.
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (workstation0912:80)
 ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)   
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, 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.AddHttp11ConnectionAsync(QueueItem queueItem)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(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>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendAsync>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReportAsync(HealthCheckConfiguration configuration) in /_/src/HealthChecks.UI/Core/HostedService/HealthCheckReportCollector.cs:line 122
[16:40:55 DBG] HealthReportCollector - health report execution history saved.
[16:40:55 DBG] Creating a new HealthReport history.
[16:40:55 DBG] HealthReportCollector has completed.
[16:40:55 DBG] HealthCheck collector HostedService executed successfully.
[16:41:05 DBG] Executing HealthCheck collector HostedService.
[16:41:05 INF] Start processing HTTP request GET http://workstation0912/health-status
[16:41:05 INF] Sending HTTP request GET http://workstation0912/health-status
[16:41:17 ERR] GetHealthReport threw an exception when trying to get report from http://WORKSTATION0912/health-status configured with name _3M Health Status.
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (workstation0912:80)
 ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|281_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)   
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, 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.AddHttp11ConnectionAsync(QueueItem queueItem)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(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>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendAsync>g__Core|5_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsC

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

    hi

    The default URL in appsettings.json is "HealthCheckUrl": "/health-status"

    Can you try to keep it as it is?

  • User Avatar
    0
    akaziuka created

    hi

    The default URL in appsettings.json is "HealthCheckUrl": "/health-status"

    Can you try to keep it as it is?

    As I said in the explanation, I didn't change/tweak the configuration. The current value is "HealthCheckUrl": "/health-status"

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Ok, Can you share the full logs when your app started?

    liming.ma@volosoft.com

    You can also change to https://localhost:44338/health-status and try again. : )

  • User Avatar
    0
    akaziuka created

    Ok, Can you share the full logs when your app started?

    liming.ma@volosoft.com

    You can also change to https://localhost:44338/health-status and try again. : )

    Tried that already and it didn't work. It picks up the machine hostname for some reason instead of the value from the config file. I just sent you the full log file to a specified address.

  • User Avatar
    1
    maliming created
    Support Team Fullstack Developer

    It's strange. We never get such feedback.

    1. Can a new template project reproduce the problem on your computer?
    2. You can try your app on another computer
    3. You can try to use https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks directly without abp to see if the same problem exists

    I think it's probably an environmental problem.

  • User Avatar
    0
    akaziuka created

    It's strange. We never get such feedback.

    1. Can a new template project reproduce the problem on your computer?
    2. You can try your app on another computer
    3. You can try to use https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks directly without abp to see if the same problem exists

    I think it's probably an environmental problem.

    I tried on multiple devices and all of them show the same behavior. Can you try this code on your end?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Ok, I will test a new template in win 11. but you can test this: Try to use https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks directly without abp

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I debug the app, and it works.

    Full URL also works.

  • User Avatar
    0
    akaziuka created

    hi

    I debug the app, and it works.

    Ok, I seem to have figured that out. I found a chunk of code in the HealthChecksBuilderExtensions.cs:

    var healthChecksUiBuilder = services.AddHealthChecksUI(settings =>
            {
                settings.AddHealthCheckEndpoint("_3M Health Status", $"http://{System.Net.Dns.GetHostName()}/health-status");
            });
    

    Whereas the right (default) value should have been this:

    settings.AddHealthCheckEndpoint("_3M Health Status", healthCheckUrl);
    

    NOTES:

    • The first option should make it work for a containerized environment + k8s (more about it here)
    • The 'default' value/option makes the solution run locally (if running/debugging the solution in the IDE)

    It would be good for you guys to document it somewhere :)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on July 17, 2025, 06:22