HttpWebRequest每个主机2个连接的限制是否适用于HttpClient? [英] Does HttpWebRequest's limit of 2 connections per host apply to HttpClient?

查看:109
本文介绍了HttpWebRequest每个主机2个连接的限制是否适用于HttpClient?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以确信地知道,每个主机2个连接的(默认)速率限制是否适用于System.Net.Http.HttpClient。

Does anybody know, with confidence if the (default) rate limit of 2 connections per host applies to System.Net.Http.HttpClient.

请说明源您的信息,以及是否可以像那样增加限制,或者是否有更好/更容易的选择

Please state the source of your information and whether this limit can be increased like this or whether there is a better/easier way to do it.

此外,是否有限制器实现?例如每分钟最多40个呼叫?

Also, is there a limiter implementation? e.g. 40 calls per minute top?

有一篇很好的文章介绍了使用Reactive Extensions的节流策略此处,但我想知道是否存在HttpClient方式。

There is a good article on a throttling tactic using Reactive Extensions here but I was wondering if there is a HttpClient way to do it.

推荐答案

根据文档(请参见备注的第三段), HttpClient 默认情况下使用 HttpWebRequest 。而且 HttpWebRequest 当然每个主机有两个并发连接限制。

According to the documentation (see the third paragraph of Remarks), HttpClient uses a HttpWebRequest by default. And HttpWebRequest certainly does have the two concurrent connections per host limitation.

HttpClient 没有说 HttpClientHandler (默认值)是否更改了 HttpWebRequest 中的任何默认值。我会怀疑的。

HttpClient doesn't say if the HttpClientHandler (the default) changes any of the defaults in HttpWebRequest. I would suspect not.

如果要更改此设置,则必须创建自己的 HttpMessageHandler 并将引用传递给 HttpClient 构造函数。

If you want to change that, you'll have to create your own HttpMessageHandler and pass a reference to the HttpClient constructor.

这篇关于HttpWebRequest每个主机2个连接的限制是否适用于HttpClient?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆