Is there a way to force pipelining in HttpWebRequest without setting ServicePointManager.DefaultConnectionLimit?
I would like to send multiple HTTP requests to a server, using pipelining where possible, and otherw开发者_JAVA百科ise using multiple TCP connections. However, HttpWebRequest seems to automatically use multiple connections if ServicePointManager.DefaultConnectionLimit is bigger than 1. I can only get it to pipeline if I set this to 1. Is there an alternative way to force pipelining?
There is no way to force pipelining using HttpWebRequest. However, if the server is 1.1 compliant,and your request method is Idempotent,you can get a high probability of pipelining being used if you use async and issue multiple requests to the same server at a time. You can also use synchronous pattern with multiple threads. The key is to issue more than one request at a time.
精彩评论