C# How to set HttpClient Keep-Alive to false

前端 未结 5 1674
一生所求
一生所求 2020-12-14 01:40

I had a low performance problem with HTTP requests on .NET. The HTTP GET request to a REST API on the localhost took about 500 ms to complete. I spent a lot of time to fix i

5条回答
  •  自闭症患者
    2020-12-14 02:18

    I hope this can help you, I have tested

    _client.DefaultRequestHeaders.Connection.Add("Keep-Alive");
    

提交回复
热议问题