我正在使用云表对象查询表存储,如下所示:
private CloudTable _table
_table.ExecuteQuery(query);
在抛出异常之前需要花费太多时间。我怎样才能改变这一点?
最佳答案
需要考虑两种超时 - 服务器超时和客户端超时。服务器超时是表服务将超时请求的时间跨度。您可以通过 ServerTimeout 设置TableRequestOptions的属性(property)类。
所以你的代码看起来像这样:
var tableRequestOptions = new TableRequestOptions()
{
ServerTimeout = TimeSpan.FromSeconds(30),//Will timeout request on the server after 30 seconds
};
CloudTable _table;
_table.ExecuteQuery(query, tableRequestOptions);
关于c# - 使用 CloudTable 对象设置查询操作的超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15290182/