如何在 Azure 存储中创建 XML 文件?
How to create a XML file in azure storage?
我是 Azure 的新手 storage.I 想在其中创建一个容器和一个 blob(XML 文件或其他)。这是创建容器的代码,但我在创建 XML 时遇到了问题(不是从本地上传)。
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
CloudBlobContainer container = blobClient.GetContainerReference("XXXXXXXX");
// Create the container if it doesn't already exist.
container.CreateIfNotExists();
谁能提供一些代码示例就太好了!!
非常感谢!
完成上述代码以获取容器的引用后,请执行以下操作:
//Create reference to a Blob that May or Maynot exist under the container
CloudBlockBlob blockBlob = container.GetBlockBlobReference("something.xml");
// Create or overwrite the "something.xml" blob with contents from a string
string s = "your XML";
await blockBlob.UploadTextAsync(s);
我是 Azure 的新手 storage.I 想在其中创建一个容器和一个 blob(XML 文件或其他)。这是创建容器的代码,但我在创建 XML 时遇到了问题(不是从本地上传)。
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
CloudBlobContainer container = blobClient.GetContainerReference("XXXXXXXX");
// Create the container if it doesn't already exist.
container.CreateIfNotExists();
谁能提供一些代码示例就太好了!!
非常感谢!
完成上述代码以获取容器的引用后,请执行以下操作:
//Create reference to a Blob that May or Maynot exist under the container
CloudBlockBlob blockBlob = container.GetBlockBlobReference("something.xml");
// Create or overwrite the "something.xml" blob with contents from a string
string s = "your XML";
await blockBlob.UploadTextAsync(s);