Deciding between HttpClient and WebClient

后端 未结 6 1288
情话喂你
情话喂你 2020-11-22 14:37

Our web app is running in .Net Framework 4.0. The UI calls controller methods through ajax calls.

We need to consume REST service from our vendor. I am evaluating

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 15:39

    HttpClientFactory

    It's important to evaluate the different ways you can create an HttpClient, and part of that is understanding HttpClientFactory.

    https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests

    This is not a direct answer I know - but you're better off starting here than ending up with new HttpClient(...) everywhere.

提交回复
热议问题