Trying to get started uploading a simple file to an Azure Storage Blob in .NET Core 3.0. I've started a brand new Razor Pages Web Application in VS, added the Azure.Storage.Blobs NuGet package (v12.4). When calling blobClient.Upload(content) in AzureBlobRepository.cs, the code just hangs. It never throws an exception and never times out. This is literally the only code in the solution (except for boiler plate code that comes with the VS template).
Index.cshtml
@page
@model IndexModel
<div class="text-center">
<form method="post" enctype="multipart/form-data">
<input type="file" asp-for="@Model.FormFile " />
<button asp-page-handler="Upload" type="submit">Submit</button>
</form>
</div>
Index.cshtml.cs
public class IndexModel : PageModel
{
public IFormFile FormFile { get; set; }
public IActionResult OnPostUpload()
{
using (var memoryStream = new MemoryStream())
{
FormFile.CopyTo(memoryStream);
var container = new BlobContainerClient("UseDevelopmentStorage=true", "testcontainer");
container.CreateIfNotExists();
BlobClient blobClient = container.GetBlobClient(FormFile.FileName);
blobClient.Upload(memoryStream); // CODE HANGS HERE FOREVER
}
return Page();
}
}