2016-09-18 12 views
9

既存のクラスライブラリコードを.NETコアクラスライブラリに変換しようとしています。ASP.NETコアのServicePointManager

ServicePointManager.DefaultConnectionLimit = 100; 
ServicePointManager.Expect100Continue = false; 

私はいくつかの検索もしなかったし、(ServicePointManager.DefaultConnectionLimit in .net core?ServicePointManagerは、もはや.NETのコアで利用可能で、WinHttpHandlerが今使用してください。staticコンストラクタでそのコードでは、私は以下のものを持っています。

私の質問は、正確にServicePointManagerとは何ですか、設定されているプロパティは何ですか?

WinHttpHandlerstaticであり、ServicePointManagerであるため、これらのプロパティを設定するにはインスタンスを作成する必要がありますか?そのインスタンスを利用するためにhttpコールをすべて変更する必要がありますか?構築時にHttpMessageHandlerから

答えて

8

WinHttpHandler継承、あなたは以下のあなたHttpClientが好き、それをパラメータとして渡すことができます。このことができます

WinHttpHandler httpHandler = new WinHttpHandler(); 
httpHandler.SslProtocols = SslProtocols.Tls12; 

HttpClient client = new HttpClient(httpHandler); 

希望を!