azure – 在通用Windows应用程序中调用FetchAttributesAsync后,A
发布时间:2020-12-14 05:43:47 所属栏目:Windows 来源:网络整理
导读:我正在制作一个小应用程序,应该列出我的Azure队列中的项目数. 当我在Console App中使用FetchAttributesAsync和ApproximateMessageCount时,在调用FetchAttributesAsync(或FetchAttributes)之后,我在ApproximateMessageCount中得到了预期的结果. 当我在通用Win
我正在制作一个小应用程序,应该列出我的Azure队列中的项目数.
当我在Console App中使用FetchAttributesAsync和ApproximateMessageCount时,在调用FetchAttributesAsync(或FetchAttributes)之后,我在ApproximateMessageCount中得到了预期的结果. 当我在通用Windows应用程序中使用相同内容时,在调用FetchAttributesAsync后,ApproximateMessageCount仍保持为null(FetchAttributes在那里不可用). 控制台代码: CloudStorageAccount _account; if (CloudStorageAccount.TryParse(_connectionstring,out _account)) { var queueClient = _account.CreateCloudQueueClient(); Console.WriteLine(" {0}",_account.QueueEndpoint); Console.WriteLine(" ----------------------------------------------"); var queues = (await queueClient.ListQueuesSegmentedAsync(null)).Results; foreach (CloudQueue q in queues) { await q.FetchAttributesAsync(); Console.WriteLine($" {q.Name,-40} {q.ApproximateMessageCount,5}"); } } 通用应用代码: IEnumerable<CloudQueue> queues; CloudStorageAccount _account; CloudQueueClient queueClient; CloudStorageAccount.TryParse(connectionstring,out _account); queueClient = _account.CreateCloudQueueClient(); queues = (await queueClient.ListQueuesSegmentedAsync(null)).Results; foreach (CloudQueue q in queues) { await q.FetchAttributesAsync(); var count = q.ApproximateMessageCount; // count is always null here!!! } 我尝试过各种各样的替代方案,比如Wait()等等等等等.无论我尝试什么,ApproximateMessageCount都保持为null并且具有dertermination :-(. 我错过了什么吗? 解决方法
我认为您在存储客户端库中发现了一个错误.我查找了Github上的代码,基本上没有读取近似消息计数标头的值,代码正在读取Lease Status标头的值.
在 public static string GetApproximateMessageCount(HttpResponseMessage response) { return response.Headers.GetHeaderSingleValueOrDefault(Constants.HeaderConstants.LeaseStatus); } 这个方法应该是: public static string GetApproximateMessageCount(HttpResponseMessage response) { return response.Headers.GetHeaderSingleValueOrDefault(Constants.HeaderConstants.ApproximateMessagesCount); } 我已经提交了一个错误:https://github.com/Azure/azure-storage-net/issues/155. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows – 如何在成功时运行多个命令
- 获取Windows 2012 Essentials和Windows 98以共享文件
- windows下编译 libjpeg以及libjpeg-turbo
- Windows – 如何调试Jenkins错误消息“找不到合适的ssh-age
- emacs – 学习Windows / C程序员的常见Lisp技巧
- 在Windows/Linux/Mac上的Java程序中对全局热键进行响应?
- 服务器安全设置技术实例系列教程--硬盘权限篇
- windows-vista – 为什么使用VNC从Vista连接到Snow Leopard
- 在Windows更新10月2日之后,azure角色不会启动
- windows-phone-7 – UserIdleDetectionMode与ApplicationId
推荐文章
站长推荐
- 如何在Windows 7上启用dhcp客户端的调试
- emacs – 如何使用elisp的反斜杠获取Windows路径
- 使用Microsoft Azure机器学习查看rgl图
- 为什么Windows身份验证/模拟在使用iis 7.5 / win
- windows-installer – 强制用户运行setup.exe而不
- 在Windows 64中javaw.exe进程消耗更多内存吗?
- windows – sublime text 2控制台仅显示gruntjs输
- windows-7 – 如何准备Windows 7的自定义安装,以
- 那里有没有工作和完整的1-Wire .NET库?
- windows-phone-7 – 播放时出现问题,WP7中录制的
热点阅读