因此,我尝试使用 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 的成员。
如果我尝试构建它,它会抛出编译错误。
我似乎缺少很多非异步方法,例如 AddMessage 和 GetMessage 知道什么可能导致此问题吗?
最佳答案
I seems like lots of non Async methods are missing such as AddMessage and GetMessage any idea what could cause this?
根据您的描述,我想您创建了一个 Console .NET Core 项目。我创建了一个简单的演示,结果如 this 。这个.NET Core项目只支持异步方法。现在没有这些同步方法。所以你没有错过这些方法。
如果您只想使用queue.CreateIfNotExists()等同步方法,我建议您可以选择Console App(.NET Framework)项目并安装WindowsAzure.Storage包再试一次。或者你可以引用这个article使用 Azure 队列。
关于c# - 未从 Azure 存储包获取所有方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48672711/