Error:

An unhandled exception occurred while processing the request.
SocketException: No connection could be made because the target machine actively refused it.
System.Net.Http.ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken)
HttpRequestException: No connection could be made because the target machine actively refused it.
System.Net.Http.ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken)

Fix:

In solutions with both web api and web projects, you will get the following error if the web api project is not running when you run the web project.

Start another instance of Visual Studio and run the web api project first, then run the web project in the current instance of Visual Studio.

Last modified: November 22, 2020

Author

Comments

Write a Reply or Comment