首页 > 解决方案 > Azure Data Box 使用 C# 上传文件

问题描述

我正在尝试使用 C# 将文件上传到 Azure Data Box,但遇到了问题。这是我的代码:

    private void uploadBlob()
    {
        String storageconn = ConfigurationManager.AppSettings.Get("StorageConnectionString");

        BlobServiceClient blobServiceClient = new BlobServiceClient(storageconn);

        BlobContainerClient container = blobServiceClient.GetBlobContainerClient("democontainer");
        Guid guid = Guid.NewGuid();
        String filename = guid.ToString();
        BlobClient blobClient = container.GetBlobClient(filename);
        byte[] memoryArray = new byte[3252224];
        var strm = new MemoryStream(memoryArray);
        blobClient.Upload(strm);
        strm.Close();
    }

当 blobClient.Upload 方法执行时,我收到以下错误:

httpheaders 之一的值格式不正确

有人对问题所在有任何想法吗?

标签: c#azure-storage

解决方案


推荐阅读