在C#HttpWebRequest 设置超时方法

HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;//创建请求对象
            request.Timeout = 2000;
            request.Method = "POST";//请求方式
            request.ContentType = "application/json";//链接类型

 request.Timeout = 2000;

使用方法:

https://www.cnblogs.com/txwtech/p/15040389.html

 

posted @ 2021-11-19 16:59  txwtech  阅读(1871)  评论(0编辑  收藏  举报