0

An unhandled exception occurred while processing the request.

I am getting These error every time i run my application in visual studio

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.ThrowException(SocketError error, CancellationToken cancellationToken)

HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:53797)
System.Net.Http.ConnectHelper.ConnectAsync(Func<SocketsHttpConnectionContext, CancellationToken, ValueTask<Stream>> callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken)

HttpRequestException: Failed to proxy the request to http://localhost:53797/, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to http://localhost:53797/.

The underlying exception message was 'No connection could be made because the target machine actively refused it. (localhost:53797)'.Check the InnerException for more details.
Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task<Uri> baseUriTask, CancellationToken applicationStoppingToken, bool proxy404s)
C47_C0D3R
  • 53
  • 8
  • `Check that the proxy target server is running and accepting requests to http://localhost:53797/` seems pretty clear to me? – Charlieface Jul 14 '22 at 10:00
  • how to check that ? – C47_C0D3R Jul 14 '22 at 12:00
  • it seems to be some blocking btween your machine and the server, are u running under an proxy server I mean the machine that you are using is a company machine for example, usally it is under proxy policy so if it is you will probably need setup it on your visual studio, I suggest you to check out this solution might be helpful https://stackoverflow.com/questions/2972600/no-connection-could-be-made-because-the-target-machine-actively-refused-it – Marcos Brinner pikatoons Aug 02 '22 at 10:54

1 Answers1

0

There are two things I would like you to try -

  1. Try changing http to https
  2. Check the launch settings and make request to the correct port no.

Please refer below screenshot enter image description here