You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HttpClient: remove redundant and outdated runtime config switch information (#5028)
Removes redundant and outdated information about runtime configuration options for HttpClient, referencing the options docs page instead.
Related PR updating the options docs: dotnet/docs#21197
Copy file name to clipboardExpand all lines: xml/System.Net.Http/HttpClient.xml
+3-24
Original file line number
Diff line number
Diff line change
@@ -112,37 +112,16 @@ On each platform, <xref:System.Net.Http.HttpClient> tries to use the best availa
112
112
Users can also configure a specific transport for <xref:System.Net.Http.HttpClient> by invoking the <xref:System.Net.Http.HttpClient.%23ctor*> constructor that takes an <xref:System.Net.Http.HttpMessageHandler>.
113
113
114
114
### HttpClient and .NET Core
115
-
116
115
Starting with .NET Core 2.1, the <xref:System.Net.Http.SocketsHttpHandler?displayProperty=nameWithType> class instead of `HttpClientHandler` provides the implementation used by higher-level HTTP networking classes such as `HttpClient`. The use of <xref:System.Net.Http.SocketsHttpHandler> offers a number of advantages:
117
-
118
116
- A significant performance improvement when compared with the previous implementation.
119
-
120
117
- The elimination of platform dependencies, which simplifies deployment and servicing. For example, `libcurl` is no longer a dependency on .NET Core for macOS and .NET Core for Linux.
121
-
122
118
- Consistent behavior across all .NET platforms.
123
119
124
-
If this change is undesirable, you can configure your application to use the older <xref:System.Net.Http.HttpClientHandler?displayProperty=nameWithType> instead in a number of ways:
120
+
If this change is undesirable, on Windows you can still use <xref:System.Net.Http.WinHttpHandler> by referencing it's [NuGet package](https://www.nuget.org/packages/System.Net.Http.WinHttpHandler/) and passing it to [`HttpClient`'s constructor`](xref:System.Net.Http.HttpClient.%23ctor(System.Net.Http.HttpMessageHandler)) manually.
125
121
126
-
- By calling the <xref:System.AppContext.SetSwitch%2A?displayProperty=nameWithType> method as follows:
122
+
### Configure behavior using run-time configuration options
- By defining the `System.Net.Http.UseSocketsHttpHandler` switch in the *.netcore.runtimeconfig.json* configuration file:
136
-
137
-
```json
138
-
"runtimeOptions": {
139
-
"configProperties": {
140
-
"System.Net.Http.UseSocketsHttpHandler": false
141
-
}
142
-
}
143
-
```
144
-
145
-
- By defining an environment variable named `DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER` and setting it to either `false` or 0.
124
+
Certain aspects of <xref:System.Net.Http.HttpClient>'s behavior are customizable through [Run-time configuration options](/dotnet/core/run-time-config/networking). However, the behavior of these switches differs through .NET versions. For example, in .NET Core 2.1 - 3.1, you can configure whether <xref:System.Net.Http.SocketsHttpHandler> is used by default, but that option is no longer available starting in .NET 5.0.
0 commit comments