简体   繁体   English

HttpWebRequest C# 的 API 超时错误 | 与邮递员和restsharp一起工作

[英]API Timeout error with HttpWebRequest C# | wroking with postman and restsharp

I am trying to make apiAPI(Expedia API for Hotel booking) with URL https://test.ean.com/2.1/itineraries?token= using C# HttpWebRequest and every time its return time out error我正在尝试使用 C# HttpWebRequest 使用 URL https://test.ean.com/2.1/itineraries?token=制作 apiAPI(用于酒店预订的 Expedia API),并且每次返回超时错误

I'm trying to send request using RestSharp some time it works , when I use PostMan or soap UI there are no problem but when I do it with code using HttpWebRequest I got error like我正在尝试使用 RestSharp 发送请求,有时它可以工作,当我使用 PostMan 或 soap UI 时没有问题,但是当我使用 HttpWebRequest 使用代码进行发送时,我得到了类似的错误

{"The operation has timed out"}

I am using below header to execute API我正在使用下面的标题来执行 API

Accept-Encoding gzip
Authorization EAN apikey=3dsc5rp4ae3hit69plc0m0af1g,signature=BFA4B8F006B99D40D693C48EC213371247D13A27850ED00ECFC23567123FD27FB1259D34DF50D240E1B99308821B758187CEA2DDF531B8D47F2B257768C89A07,timestamp=1547040437
Customer-Ip 192.168.1.1
User-Agent  Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Test standard
accept application/json

Can any one please help me to resolve time out error with HttpwebReuqest任何人都可以帮助我解决 HttpwebReuqest 超时错误

Thank you in advance先感谢您

I got alternative solution, Using RestStarp Version 105.2.3 its working fine.我得到了替代解决方案,使用 RestStarp 版本 105.2.3 工作正常。 Older version of restsharp was not consistence but new version is working fine旧版本的restsharp不一致,但新版本工作正常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM