Open Closed

No connection could be made because the target machine actively refused it #9702


User avatar
0
punta created
  • ABP Framework version: v8.2.0
  • UI Type: MVC
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • **Tiered: yes
  • Exception message and full stack trace:
  • An unhandled exception occurred while processing the request. SocketException: No connection could be made because the target machine actively refused it.

System.Net.Sockets.Socket+AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(short token) HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:44371)

System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(string host, int port, HttpRequestMessage initialRequest, bool async, CancellationToken cancellationToken) IOException: IDX20804: Unable to retrieve document from: 'https://localhost:44371/.well-known/openid-configuration'.

Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(string address, CancellationToken cancel) InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://localhost:44371/.well-known/openid-configuration'. Will retry at '7/31/2025 7:50:28 AM +00:00'. Exception: 'System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://localhost:44371/.well-known/openid-configuration'. ---> System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:44371) ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it. at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_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.InjectNewHttp11ConnectionAsync(QueueItem queueItem) at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionWaiter1.WaitForConnectionWithTelemetryAsync(HttpRequestMessage request, HttpConnectionPool pool, Boolean async, CancellationToken requestCancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, 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 Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.SendAndRetryOnNetworkErrorAsync(HttpClient httpClient, Uri uri) at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel) at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)'.

Microsoft.IdentityModel.Protocols.ConfigurationManager

  • Steps to reproduce the issue:
  • Prepare a tiered solution with parameters specified above. Configure the .api.host and .web projects for startup

1 Answer(s)
  • User Avatar
    1
    AI-Bot created
    Support Team ABP Agent
    • The error No connection could be made because the target machine actively refused it. (localhost:44371) indicates that your application is trying to connect to an OpenID Connect authority at https://localhost:44371/.well-known/openid-configuration, but nothing is running on that address/port.

    • In a tiered ABP solution, the .Web and .HttpApi.Host projects typically use the .AuthServer project as the OpenID Connect authority. If the .AuthServer is not running, or if the Authority URL in your configuration points to the wrong address, you will get this error.

    How to fix:

    1. Start the AuthServer

      • Ensure the .AuthServer project is running and accessible at the URL specified in your configuration (e.g., https://localhost:44371).
    2. Check Configuration

      • In your .Web and .HttpApi.Host projects, verify the AuthServer:Authority setting in appsettings.json or appsettings.Development.json:
    "AuthServer": {
           "Authority": "https://localhost:44371",
           "RequireHttpsMetadata": "false"
         }
    
    • Make sure this matches the actual running URL of your .AuthServer project.
    1. Check Launch Settings

      • In Properties/launchSettings.json of the .AuthServer project, confirm the application is set to launch on the correct port (44371).
    2. Run All Projects

      • When developing locally, you must run the .AuthServer, .HttpApi.Host, and .Web projects simultaneously. If using Visual Studio, set them all as startup projects.
    3. Firewall/Port Conflicts

      • Ensure no firewall or other application is blocking port 44371.
    4. Production/Containerized Environments

      • If deploying, ensure the Authority URL is set to the deployed AuthServer's public address, not localhost.

    Summary:
    This error is caused by the .Web or .HttpApi.Host project being unable to reach the .AuthServer at the configured URL. Make sure the AuthServer is running and the configuration matches its actual address.

    No validated source available for this specific query.


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
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 September 12, 2025, 10:20