Description
The guidance here is confusing because it implies that by deriving classes you would might have multiple instances, but the other guidance states this should not be the case. Which is it? Let's say you do derive from HttpClient to have a FacebookHttpClient and GoogleHttpClient, but they share the same static instance, how would this work throughout a application, especially if you need to execute concurrent http requests? What if you need to switch between using default credentials or not? I do understand about using all the sockets, connection pooling, and HttpClient acting as a session, but the guidance should be more clear if multiple are in fact allowed in a derived scenario, and guidance on how to best implement that. It would seem to me that there are scenarios where more than one HttpClient instance is going to be required by an application?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: cbd5007c-82e5-a0c1-2156-7df4bbbcc2da
- Version Independent ID: eba98e03-3cc2-bebe-3dcd-45eda9c9c378
- Content: HttpClient Class (System.Net.Http)
- Content Source: xml/System.Net.Http/HttpClient.xml
- Product: dotnet-api
- GitHub Login: @karelz
- Microsoft Alias: ncldev