I tried with HttpPut and HttpPost but nether called my API method.
Make sure the port is correct and it can find the action correctly.
HttpRequestMessage httpRequest = new HttpRequestMessage(HttpMethod.Post, $"https://localhost:44306/account/UpdateUser/");
I tested these code without the 'gateway' and they works well, so the problem may lies on it, you should check whether your gateway can work well
ExceedingLife
I get a 400 bad request and 404 not found.
Could you please tell us about their scenes?
400 bad request often caused by the bad request, means the request can not access the action.
404 error often means can not find the url.
You can set break point to check whether you have these mistakes.
Best Regards,
Jerry Cai
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Participant
990 Points
327 Posts
Re: .net core mvc update call API with httpclientfactory
Dec 28, 2020 09:33 AM|Jerry Cai|LINK
Hi,ExceedingLife
HttpRequestMessage httpRequest = new HttpRequestMessage(HttpMethod.Post, $"https://localhost:44306/account/UpdateUser/");
Could you please tell us about their scenes?
You can set break point to check whether you have these mistakes.
Best Regards,
Jerry Cai