Azure 存储上传错误

Azure Storage upload Bug

我不知道这是否是错误,但我制作了一个 Xamarin 应用程序,它将连接到 Azure 存储以上传文件。

它不想上传,我收到这个错误

Azure service, to upload the file

我制作了相同的应用程序,使用控制台应用程序(用于测试 fester)

    var path = Path.Combine(projectPath, "universal.txt");

var fullpath = Path.GetFullPath(path);

var FileName = Path.GetFileName(fullpath);

using (StreamWriter sw = new StreamWriter(fullpath)) {

    sw.WriteLine("Hello I want to  go to Universal tomorrow");
}


var AzureStorage = new BlobContainerClient(ConectionString, ContanerName);

var blob = AzureStorage.GetBlobClient(FileName);
await blob.UploadAsync(fullpath);

我的文件上传到 Azure

File in storage

使用这些函数从 xamarin 上传文件。

static CloudBlobContainer GetContainer(ContainerType containerType)
{
  var account = CloudStorageAccount.Parse(Constants.StorageConnection);
  var client = account.CreateCloudBlobClient();
  return client.GetContainerReference(containerType.ToString().ToLower());
}

public static async Task<string> UploadFileAsync(ContainerType containerType, Stream stream)
{
  var container = GetContainer(containerType);
  await container.CreateIfNotExistsAsync();

  var name = Guid.NewGuid().ToString();
  var fileBlob = container.GetBlockBlobReference(name);
  await fileBlob.UploadFromStreamAsync(stream);

  return name;
}


client = new BlobServiceClient(storageConnectionString);
containerClient = await client.CreateBlobContainerAsync(containerName);

blobClient = containerClient.GetBlobClient(fileName);
await containerClient.UploadBlobAsync(fileName, memoryStreamFile);