【发布时间】:2013-02-28 04:21:56
【问题描述】:
我正在使用 Azure 存储,在容器上调用命令时遇到了一些问题。我通过单元测试运行它,有时当在容器上调用命令时,它只是坐下来等待该命令近 5 分钟。如果我等待足够长的时间,它将继续并成功。运行时,容器确实存在,因此根本不必创建容器。
还有其他人遇到过这个问题吗?我尝试在BlobRequestOptions 上设置ServerTimeout,但没有任何影响。
这是我的代码正在执行的示例:
var blobClient = _storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference(containerName);
var options = new BlobRequestOptions() { ServerTimeout = TimeSpan.FromSeconds(10) };
if (!container.Exists(options)) //<<<<this is where it hangs
{
container.Create();
}
我也试过CreateIfNotExists():
var blobClient = _storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference(containerName);
container.CreateIfNotExists(); //<<<this is where it hangs
如果我只是尝试列出 blob,它也会挂起
var blobClient = _storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference(containerName);
container.ListBlobs(); //<<<<this is where it hangs
不是每个容器都会发生这种情况,但是当它发生在一个容器上时,它似乎是同一个容器。我检查过,容器确实存在。
【问题讨论】:
-
本地或云端配置?
-
云配置。而且我刚刚发现它不仅仅是这两个命令,它是容器上的任何命令。我已经更新了我的问题。
-
您是否使用过 Fiddler 或 Netmon 之类的工具来查看请求是否正在等待存储服务(即等待 HTTP 调用返回),或者延迟是否在您的应用程序中(即。没有空闲的工作线程来处理请求)?
标签: c# azure azure-storage azure-blob-storage