Consider replacing WebClient with HttpClient in Metadataservice
See original GitHub issueand maybe add using
statements.
Also add optional support for the RP to provider their own instance of HTTPClient (because of socket control?).
Reasons to do this are listed in this SO answer: https://stackoverflow.com/questions/20530152/deciding-between-httpclient-and-webclient
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
How to Replace WebClient with HttpClient?
Injecting HttpClient would be a better idea if possible HttpClient client = new(); string page = await client.GetStringAsync("page URL here");.
Read more >When to use WebClient vs. HttpClient vs. HttpWebRequest
However, you should be aware that HttpClient was never designed to be a replacement for WebClient. You should use HttpWebRequest instead of ......
Read more >Sending HTTP requests with Spring WebClient
As part of this, Spring 5 introduced the new WebClient API, replacing the existing RestTemplate client. Using WebClient you can make ...
Read more >WebRequest, WebClient, and ServicePoint are obsolete - . ...
Learn about the breaking change in .NET 6 where WebRequest, WebClient, and ServicePoint are deprecated in favor of HttpClient.
Read more >Spring 5 WebClient
In this tutorial, we're going to examine WebClient, which is a ... module and will be replacing the classic RestTemplate in these scenarios....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just briefly checked the commit.
We should really not block with .Result. See Sync over Async: https://github.com/davidfowl/AspNetCoreDiagnosticScenarios/blob/master/AsyncGuidance.md#avoid-using-taskresult-and-taskwait
@aseigler Hmm, that’s strange! just try to build it (perhaps
dotnet restore
does also help).@abergs Creating always a new instance of the
HttpClient
withusing
statement isn’t a good idea.HttpClient
is intended to be instantiated once and reused throughout the life of an application - see docs and this blog post.