c# - 使用 CloudTable 对象设置查询操作的超时

标签 c# azure cloud azure-storage

我正在使用云表对象查询表存储,如下所示:

   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/

相关文章:

c# - 在 C++ 中为 Windows Phone 8 使用 C# dll

Azure 服务计划和非生产槽

.net - 在云上部署 .NET Windows 应用程序

firebase - Firestore 使用动态键更新嵌套对象中的字段

Windows Azure Toolkit for Java 插件无法在 Mac 上运行

c# - 从 MS Access 转换 OLE 图像对象以在 .NET 中使用

c# - 在没有完整回发的情况下执行服务器端代码

powershell - 将多个证书从同一 KeyVault 添加到新的 VMSS

azure - 无法使用 azure JavaScript 函数和 Key Vault key 检索 cosmosDB 数据

c# - 如何使用 C# 在 DataGridView 中制作一个唯一的列?