When testing locally using a project that issues HTTP POST requests from a program created in Visual Studio, ie: using System.Net.Http.HttpClient, HttpClient always returns:
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:7170
I can make POST requests using PostMan or GET requests using a browser, but when trying to test functions locally using System.Net.Http.HttpClient calls from within Visual Studio -- it seems impossible, due to the error above.
I also tried to set the following within Web.Config (suggested in a StackOverFlow post):
No effect !
HOW can I test functions locally from programs running within Visual Studio -- specifically, when using System.Net.Http.HttpClient -- please provide an example.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@bdcoder2 Thanks for the feedback! We are currently investigating and will update you shortly.
Oh good grief – my sincerest apologies!
I had http://localhost:7170/ as the base URL in a config file rather than (the correct) http://localhost:7071/
Two hours looking at the exception and I didn’t clue in – time for a holiday!
Once again – sorry for the false alarm and thanks for the quick reply !!
@bdcoder2 thanks for the update and glad to hear you figured it out. And no worries, it happens to the best of us :)
Most helpful comment
Oh good grief – my sincerest apologies!
I had http://localhost:7170/ as the base URL in a config file rather than (the correct) http://localhost:7071/
Two hours looking at the exception and I didn’t clue in – time for a holiday!
Once again – sorry for the false alarm and thanks for the quick reply !!