今天在调用一个网站时发现,在执行一个请求时,一直提示超时,单步操作没问题,放到线程里就一直超时,

需要加上System.Net.ServicePointManager.DefaultConnectionLimit = 512;//默认值好像是2,所以跑不起来

2021-8-25

还可以加上下面这部分代码

request.ServicePoint.Expect100Continue = false;
request.Timeout = Timeout.Infinite;
request.KeepAlive = true;

 

 posted on 2021-03-30 09:22  HYRUI  阅读(899)  评论(0编辑  收藏  举报