RestSharp“操作已经超时”

时间:2018-02-24 22:16:42

标签: c# c#-4.0 restsharp

我使用RestSharp执行POST请求:var response = client.Execute(request);

此请求在response{"The operation has timed out"}内返回错误异常。

这是什么原因?如何解决?

1 个答案:

答案 0 :(得分:2)

如果您还没有找到答案,请查看Timeout属性。 HttpWebRequest默认值为100秒,我无法找到任何暗示RestSharp更改超时默认值的数据。

https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.timeout(v=vs.110).aspx

在以下代码行中,这会将超时设置为5分钟。

    request.timeout = 300000;
相关问题