CodexBloom - Programming Q&A Platform

Azure Blob Storage - implementing C# SDK and Multi-Part Uploads Timing Out

👀 Views: 0 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-16
azure blob-storage csharp azure-storage

I'm working on a project and hit a roadblock. This might be a silly question, but I'm currently working on uploading large files to Azure Blob Storage using the Azure.Storage.Blobs SDK for .NET (version 12.10.0), and I'm working with timeout issues when performing multi-part uploads. I have a file that is around 500 MB, and during the upload process, I consistently receive a `RequestTimeout` behavior after about 30 seconds of trying to upload a chunk. Here's the basic code I'm using for the upload: ```csharp using Azure.Storage.Blobs; using Azure.Storage.Blobs.Specialized; var blobServiceClient = new BlobServiceClient("<your_connection_string>"); var containerClient = blobServiceClient.GetBlobContainerClient("my-container"); await containerClient.CreateIfNotExistsAsync(); var blobClient = containerClient.GetBlobClient("largefile.dat"); var blobStream = File.OpenRead("path/to/largefile.dat"); await blobClient.UploadAsync(blobStream, new BlobHttpHeaders { ContentType = "application/octet-stream" }); ``` I tried increasing the `RequestTimeout` property of the `BlobClientOptions` like this: ```csharp var options = new BlobClientOptions { Retry = { MaxRetries = 5, Mode = RetryMode.Exponential } }; var blobServiceClient = new BlobServiceClient("<your_connection_string>", options); ``` However, the timeout still occurs, and I also verified that my Azure Storage account is not experiencing any service issues. I'm not sure what I might be missing here. Should I be handling the upload in a different way for large files? Any insights or suggestions on how to resolve this would be greatly appreciated! This is part of a larger application I'm building. What's the best practice here? My development environment is Windows. How would you solve this?