none
API calls failing intermittently with HttpClient RRS feed

  • Question

  • API calls failing intermittently with HttpClient but works well with RESTClient. What is the main difference between these two libraries which may cause this issue ?

    Its a POST call which i making to a third party API. And the third party API takes 2 - 3 minutes to respond. I am using HTTPClient library for all the API calls but due to the intermittent behavior of HTTPClient, i have started using RESTClient for this API call.

    The RESTClient is giving me 99% successful API calls while HTTPClient is giving 60-70% successful calls.

    Can anyone please help me to identify the main difference between these two libraries which may cause this issue ?


    Wednesday, October 9, 2019 11:32 AM

All replies

  • Hi Deependra Singh ITT, 

    Thank you for posting here.

    According to your question, I hope the following reference can help you.

    YOU'RE USING HTTPCLIENT WRONG AND IT IS DESTABILIZING YOUR SOFTWARE

    As Microsoft document says, HttpClient is intended to be instantiated once and re-used throughout the life of an application. Instantiating an HttpClient class for every request will exhaust the number of sockets available under heavy loads. This will result in SocketException errors.

    Besides, here’s the reference about differences between two libraries.

    Difference between HTTP Client and REST Client  

    Hope it can help you.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, October 10, 2019 5:34 AM
    Moderator