dotnet / dotnet/dotnet-api-docs

Thread safety of BaseAddress and DefaultRequestHeaders

Open
#1,085 2 comments 2 reactions 0 assignees View on GitHub
area-System.Net dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

It would be good to add a note that changing BaseAddress or DefaultRequestHeaders is *not* a thread-safe operation, and you should change them on concurrent requests.

See [here](http://www.michaeltaylorp3.net/httpclient-is-it-really-thread-safe/) and mspnp/architecture-center#935

---
#### 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)](https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=netframework-4.7.2)
* Content Source: [xml/System.Net.Http/HttpClient.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Net.Http/HttpClient.xml)
* Product: **dotnet-api**
* GitHub Login: @karelz
* Microsoft Alias: **ncldev**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.