c# - CloudTableClient客户端超时

标签 c# azure azure-storage azure-table-storage

使用 CloudTableClient 时,有没有办法指定客户端超时?

TableRequestOptions RetryPolicy 和 ServerTimeout 控制重试尝试次数、尝试之间的延迟以及存储服务端超时,但似乎不涵盖客户端每次尝试超时(如 HttpClient.Timeout 属性)。

我对依赖 ServerSideTimeout 的担忧是连接到实际服务器的延迟。

最佳答案

When using a CloudTableClient, is there a way to specify a client side timeout?

TableRequestOptions 的 MaximumExecutionTime 属性可以帮助我们指定请求的所有潜在重试的最大执行时间,包括客户端和服务器端使用的时间。

tableClient.DefaultRequestOptions.MaximumExecutionTime = new TimeSpan(0, 0, 0, 0, 100);

如果在指定时间内无法处理请求,则会抛出异常。

Microsoft.WindowsAzure.Storage.StorageException: 'The client could not finish the operation within specified timeout.'

like the HttpClient.Timeout property

HttpClient 的 Timeout 属性还指定了响应返回之前的所有执行时间。

I'm hoping to find a per-retry timeout.

我建议您使用MaximumExecutionTime。如果您需要客户端 DNS 解析超时,您可以获取或设置 DnsRefreshTimeout ServicePointManager 的属性。

ServicePointManager.DnsRefreshTimeout = 4*60*1000; // 4 minutes

关于c# - CloudTableClient客户端超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44318005/

相关文章:

C#: 'IEnumerable<Student>' 不包含 'Intersect' 的定义

c# - 使用 HTML Agility Pack 关联相邻元素值

c# - WPF - 项目模板的网格用法

azure - 如何将 ssis 原始文件转换为 Parquet

asp.net - web.config 重写规则在 Blob 存储中的 Azure 静态网站中不起作用

python - 使用 python 从表存储中检索超过 1000 行

c# - .Net Core 3.0 Angular SSR 项目未运行

azure - Azure 门户中的连接字符串/设置 - 是 xdt :Transform ="SetAttributes", 还是 xdt :Transform ="Insert" or hybrid?

c# - 由于我使用的是 mac,所以我在 azure data studio 中在哪里可以找到连接字符串,并且我将需要它

azure - Azure 存储中的 VHD 如何收费?