HttpWebRequest Port Exhaustion

前端 未结 3 877
梦毁少年i
梦毁少年i 2021-02-09 22:39

We are using a Windows Service to make very frequent HTTP calls to an internal REST service (20-40 calls per second), but notice a long delay in getting responses after the serv

3条回答
  •  青春惊慌失措
    2021-02-09 23:41

    How can we ensure that ports are reused? Not set the connection limit to a value that almost guarantees that they won't be.

    It looks like someone has monkeyed with the ServicePointManager at some point. I'd limit the ServicePoint for this origin: to encourage http pipelining and connection reuse:

    ServicePointManager.FindServicePoint(Uri).ConnectionLimit = someSensibleValue;
    

提交回复
热议问题