Keep a http connection alive in C#?

后端 未结 5 775
后悔当初
后悔当初 2021-01-12 00:04

How do i keep a connection alive in C#? I\'m not doing it right. Am i suppose to create an HttpWebRequest obj and use it to go to any URLs i need? i dont see a way to visit

5条回答
  •  天命终不由人
    2021-01-12 00:34

    I had a similar issue when HttpWebRequest.KeepAlive = true was not enough to keep it alive. The connection stayed on only after I set request.UnsafeAuthenticatedConnectionSharing = true and ServicePointManager.MaxServicePointIdleTime = 100000;//avoid 0 or low values

提交回复
热议问题