为什么postman发出的请求可以正常响应但是C#就不行

C#使用postman框架发送请求

GET请求在使用RestSharp时不产生响应,但在Postman中获得响应

为什么postman发出的请求可以正常响应但是C#就不行

postman中post请求正常,但是利用postman生成C#后台http模拟代码之后调用失败问题记录

postman中post请求正常,但是利用postman生成C#后台代码无响应

为什么它在Postman中可以工作,而在我的C#代码中却不能

var url = string.Format("https://xx.html", id, xianlu, ep);
 var htmlText = "";
 Sharing.setTips("动漫id已发出请求..."); 
 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
 var client = new RestClient(url);
 client.Timeout = -1;
 var request = new RestRequest(Method.GET);
 request.AddHeader("Authorization", "Bearer tokenComesHere");
 IRestResponse response = client.Execute(request);
 htmlText = response.Content;

原因1. 需要加  ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

2. 需要加请求头

3.目标网站本身的问题

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-10 18:14:04       5 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-10 18:14:04       5 阅读
  3. 在Django里面运行非项目文件

    2024-07-10 18:14:04       4 阅读
  4. Python语言-面向对象

    2024-07-10 18:14:04       6 阅读

热门阅读

  1. 广州网络机房搬迁改造方案公司

    2024-07-10 18:14:04       11 阅读
  2. 什么是voc数据,和coco数据的区别是什么?

    2024-07-10 18:14:04       10 阅读
  3. Spring Boot 创建定时任务

    2024-07-10 18:14:04       10 阅读
  4. Redis

    2024-07-10 18:14:04       9 阅读
  5. C语言2D游戏

    2024-07-10 18:14:04       6 阅读
  6. Docker 容器出现 IP 冲突

    2024-07-10 18:14:04       9 阅读
  7. 构建安全稳定的应用:SpringSecurity实用指南

    2024-07-10 18:14:04       10 阅读
  8. 事务的范围比锁的范围大

    2024-07-10 18:14:04       10 阅读
  9. 深度解析:如何利用Python高效挖掘SQLite潜力

    2024-07-10 18:14:04       8 阅读
  10. C# 策略模式(Strategy Pattern)

    2024-07-10 18:14:04       9 阅读