0

Hope you all are safe and doing well.

I am new to React and ASP.NET. I was trying to setup a asp.net core webapp following the tutorial.

When I run npm start the application spins up correctly, but when I try to add any user-detail, in network tab the API call fails with net::ERR_CONNECTION_REFUSED. Also I am not sure, if I should hit localhost:3000 it gives 404 or localhost:5000 to hit the API. although in tutorial it hits 5001. When I try to hit 10.0.2.2:5001 (again based on some other provided solution)I start getting connection time out. I tried various solutions including this but none of them seem to be working for me.

The code is exactly the same as I am trying to run the cloned project, but let me know if I need to paste more details.

I am actually trying to setup a company project following the same modules given in the tutorial but facing the same error and the call from app to controller is not happening with the same error.

Any help is much appreciated. Thanks in advance.

nikhil
  • 75
  • 1
  • 10
  • Take a look at the output panel of visual studio, there should be a message that server was started including the url where it's listening. – Christoph Lütjen May 12 '20 at 08:07
  • Thanks for the comment, when I started "IIS Express" and used to make the API call as per the settings in launchSettings.json it is working. However, when I try to replicate the same in the company project it is still giving me that connection refused error. – nikhil May 12 '20 at 08:42
  • And what does your company project output where it's listening? Btw. afaik api should listen on the same port where your app is hosted. That said, if you get a connection with 404 response, it should be a routing problem. – Christoph Lütjen May 12 '20 at 12:56
  • Yeah I got it solved by changing the ports for IIS settings in launchSettings.json. Calling with that port got it working. – nikhil May 13 '20 at 12:12

0 Answers0