c++ - 简单 Azure 示例中的异常?
问题描述
我正在 C++ 中尝试 Azure(VS 2019)并获得了这里推荐的 vcpkg 包(32 位和 64 位) https://azure.github.io/azure-storage-cpp/ 然后在这里尝试了示例 https:// docs.microsoft.com/en-us/azure/storage/blobs/storage-c-plus-plus-how-to-use-blobs
我启动了一个新的 C++ 控制台应用程序并做到了这一点
#include <iostream>
#include <was\blob.h>
#include <was\storage_account.h>
int main()
{
std::cout << "Hello World!\n";
utility::string_t name = L"--------"; // my stuff blotted out
utility::string_t key = L"---------"; // my stuff blotted out
utility::string_t con = L"DefaultEndpointsProtocol=https;AccountName=" + name + L";AccountKey=" + key;
// Define the connection-string with your values.
const utility::string_t storage_connection_string(con);
// Retrieve storage account from connection string.
azure::storage::cloud_storage_account storage_account = azure::storage::cloud_storage_account::parse(storage_connection_string);
// Create the blob client.
azure::storage::cloud_blob_client blob_client = storage_account.create_cloud_blob_client();
// Retrieve a reference to a previously created container.
azure::storage::cloud_blob_container container = blob_client.get_container_reference(U("demo"));
// Retrieve reference to a blob named "my-blob-2".
azure::storage::cloud_block_blob text_blob = container.get_block_blob_reference(U("Job.ini"));
// Download the contents of a blog as a text string.
utility::string_t text = text_blob.download_text();
执行 download_text() 调用会引发异常。
在 64 位中,它只是一个“xxx 处的异常”消息,然后是一个对话框,说明 IsCompleted() 的断言失败。在 32 位中,它在对话框之前的第二条消息中显示了更多详细信息,因为“ESP 的值没有在函数调用中正确保存”我也尝试了 download_to_stream() 示例,结果相同。帐户很好,容器和 blob 存在,blob 客户端和容器步骤很好,数据看起来还不错,只是在尝试实际拉下某些东西时失败了。
- 任何线索?
解决方案
对不起,伙计们。这是在有缺陷的最终用户类中 - 我使用了错误的存储帐户并且不理解异常。请忽略。
推荐阅读
- google-apps-script - 将附件从 gMail 保存到 gDrive?
- windows - 如何在 Go 中获取 Windows 显示名称?
- python-3.x - 当您不确切知道要匹配的内容时,可变长度的前瞻/后置正则表达式(python)
- php - 为什么我的 ftp 连接在 php laravel 中不起作用,但在 FileZilla 中起作用?
- c# - Windows 服务触发事件
- html - 预填充输入字段时,HTML 将时间值转换为正确的格式
- amazon-web-services - 我的存储桶是否应该对我的用例公开,我应该如何避免不良做法?
- node.js - 自调用异步函数中的哨兵错误跟踪
- class - 在类中创建 Pygame 表面时出现 ValurError
- node.js - 我想知道为什么会出现该错误:找不到模块