Skip to content

Commit

Permalink
Update vulnerabilities-cbc-mode.md (#27894)
Browse files Browse the repository at this point in the history
* Update vulnerabilities-cbc-mode.md

[Refresh link]Replace bookmarks in repo

* TASK 536167:[Refresh link]Replace bookmarks in repo

* Update use-httpclientfactory-to-implement-resilient-http-requests.md

* Update use-httpclientfactory-to-implement-resilient-http-requests.md

Updated
  • Loading branch information
v-haiboz committed Feb 16, 2022
1 parent ea261aa commit 17cac6d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Therefore, `HttpClient` is intended to be instantiated once and reused throughou

Another issue that developers run into is when using a shared instance of `HttpClient` in long-running processes. In a situation where the HttpClient is instantiated as a singleton or a static object, it fails to handle the DNS changes as described in this [issue](https://github.com/dotnet/runtime/issues/18348) of the dotnet/runtime GitHub repository.

However, the issue isn't really with `HttpClient` per se, but with the [default constructor for HttpClient](/dotnet/api/system.net.http.httpclient.-ctor?view=netcore-3.1#System_Net_Http_HttpClient__ctor&preserve-view=false), because it creates a new concrete instance of <xref:System.Net.Http.HttpMessageHandler>, which is the one that has *sockets exhaustion* and DNS changes issues mentioned above.
However, the issue isn't really with `HttpClient` per se, but with the [default constructor for HttpClient](/dotnet/api/system.net.http.httpclient.-ctor#system-net-http-httpclient-ctor), because it creates a new concrete instance of <xref:System.Net.Http.HttpMessageHandler>, which is the one that has *sockets exhaustion* and DNS changes issues mentioned above.

To address the issues mentioned above and to make `HttpClient` instances manageable, .NET Core 2.1 introduced the <xref:System.Net.Http.IHttpClientFactory> interface which can be used to configure and create `HttpClient` instances in an app through Dependency Injection (DI). It also provides extensions for Polly-based middleware to take advantage of delegating handlers in HttpClient.

Expand Down

0 comments on commit 17cac6d

Please sign in to comment.