【发布时间】:2018-02-07 20:29:34
【问题描述】:
所以我尝试在 Azure 存储中使用队列,因此我创建了一个控制台应用程序并在 NuGet 中添加了 WindowsAzure.Storage 包。然后我把这段代码放进去,它会为我创建一个队列。
static void Main(string[] args)
{
string connection = "myConnectionString......";
CloudStorageAccount storageAcc = CloudStorageAccount.Parse(connection);
CloudQueueClient queueClient = storageAcc.CreateCloudQueueClient();
CloudQueue queue = queueClient.GetQueueReference("myQueue");
queue.CreateIfNotExistsAsync();
Console.ReadKey();
}
但是应该有一个我可以调用的非异步版本
queue.CreateIfNotExists();
但 Visual Studio 2017 并未将 CreateIfNotExists 识别为 CloudQueue 的成员。
如果我尝试构建它会引发编译错误。
我似乎缺少很多非 Async 方法,例如 AddMessage 和 GetMessage 知道是什么原因造成的吗?
【问题讨论】:
-
如果您使用的是 .Net Core,那么这是一个已知问题。 .Net Core 版本的 SDK 中未实现同步方法。
-
是否有任何关于将 SDK 与 .NET Core 结合使用的文档或博客文章?
-
与 .Net 相同。您唯一需要记住的是仅使用异步方法。
标签: c# visual-studio azure