Error running ASP.NET Core application

Asked

Viewed 941 times

0

I am starting the journey to learn ASP.NET Core and when I try to run the application I have the following error:

An unhandled Exception occurred while Processing the request. Socketexception: No connection could be made as the machine fate actively refused them System.Net.Http.ConnectHelper.Connectasync(string host, int port, CancellationToken cancellationToken)

Httprequestexception: No connection could be made as the machine of fate actively refused them System.Net.Http.ConnectHelper.Connectasync(string host, int port, CancellationToken cancellationToken)

Httprequestexception: Failed to proxy the request to http://localhost:4200/, because the request to the proxy target failed. Check that the proxy target server is running and Accepting requests to http://localhost:4200/.

The underlying Exception message was 'No connection could be made because the destination machine has actively refused them'. Check the Innerexception for more Details. Microsoft.AspNetCore.Spaservices.Extensions.Proxy.SpaProxy.Performproxyrequest(Httpcontext context, Httpclient httpClient, Task baseUriTask, Cancellationtoken applicationStoppingToken, bool proxy404s)

I thought maybe it could be some problem with CORS, but both client and server are together, so that shouldn’t be the problem.

  • This error can be caused if any service is using the same port

  • I think not, I used NESTAT to see and there is no one using this door. The ISS generates two port options and the problem happens in both.

  • Use p nestat -anb after starting IIS to see if it is running and with the expected port. This could be the wrong port, it could be a firewall blocking the connection, it might not really be active...

  • There is a VM (Vmware) running on this port, with the command nestat -anb appeared. Unfortunately I cannot stop or change the port of this service. You can change the application port?

  • a silly question... you are trying to access the application from the same machine on which it is running, right?

1 answer

-1

With me happened the same thing, it runs I did the following way, separate the projects and surround each one in a window of Visual Studio 2019 different and worked because each one uses a different port. I couldn’t find a better way, and when the two projects were in the same Soluction I couldn’t configure IIS Express to run each one in a different port.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.