This issue is very similar to the Java one documented here: https://issues.apache.org/jira/browse/THRIFT-970
.NET Core supports using an IHttpClientFactory to request instances of HttpClient. This factory will pool clients to avoid exhausting sockets in the OS. Microsoft currently do not recommend creating a new HttpClient per request, consumers currently have to find a way to pool Thrift clients in order to conform to this practice.
The line which instantiates a new HttpClient can be found here.
This proposal would require a new constructor which allowed an instance of HttpClient to be passed in. The consumer could use this constructor like this:
After registering their own named IHttpClientFactory in the ServiceCollection:
Rather than relying on users to properly configure request headers and decompression methods themselves, an extension method to ServiceCollection could be defined:
This would more closely match the current constructor of THttpTransport.
We've forked the THttpTransport file to support this behaviour for internal purposes, so I could put up a sample PR if requested.