Last post May 29, 2019 12:08 PM by PatriceSc
May 28, 2019 05:11 PM|Guhananth|LINK
May 28, 2019 05:19 PM|mgebhard|LINK
I am using httpclient.when live data comes from url in post method I get one or more error.it goes directly into catch block.
Var st= await new httpclient().post(url,content);
What is the error?
The code shown does not compile and therefore cannot be the same code that causes a run-time error.
May 29, 2019 02:02 AM|Fei Han - MSFT|LINK
Are you using the code like below to make request?
var st = await new HttpClient().PostAsync(url, content);
if (st.StatusCode == HttpStatusCode.OK)
catch (Exception ex)
it goes directly into catch block
Please make sure you provided a valid request URI, and please check and share the detail error message, so that we can help troubleshoot the issue better.
May 29, 2019 02:19 AM|Guhananth|LINK
May 29, 2019 07:43 AM|Fei Han - MSFT|LINK
Please debug your code step by step, which would help you find the code snippet that causes the error. And you can share us detailed error message for further troubleshooting.
May 29, 2019 08:14 AM|Guhananth|LINK
May 29, 2019 11:13 AM|mgebhard|LINK
When service is down.message seen in postman must be displayed.i do not want message as one or more error.
The client application is responsible for catching exceptions. Using a try...catch block is the standard.
You can learn about try...catch at the following links.
A downed service will cause the HttpClient PostAsync to timeout. Filter the catch by HttpRequestException. Then in the catch write code to meet your requirements.
May 29, 2019 12:08 PM|PatriceSc|LINK
You'll have to handle that in your catch block (not sure what Postman is showing when the service can't even be reached). If it could happen for a short period you could also use a retry logic etc.. depending on what makes sense for this situation.