There is a similar question to this but it was three years ago, no solution given and it used different methods. I have a BlobImageStore.cs file which was eseentially copied from a Microsoft given GitHub sample on using Blob Storage to upload images. This was working without a problem. Went away for a few weeks and am trying to get back to work but now I'm getting this 400 OutOfRangeInput
exception. Thought it was filename as I was creating a new Guid to use as the filename which didn't have a problem, but I used the work "test" anyway and still am getting the same exception.
Does anyone have an idea of what the problem could be if I've always been uploading an IFormFile from the stream with the blob name of a new GUID or just a simple name like "test" failing suddenly?
public async Task<Uri> UploadImageToLibraryAsync(Stream stream, string blobName)
{
try
{
var result = await _containerClient.UploadBlobAsync(blobName, stream);
return GetBlobUri(_containerClient.GetBlobClient(blobName));
}
catch (Exception ex)
{
throw ex;
}
}
I then did a second test where I created a whole new top level client and worked all the way down to downloading a blob. It all worked one by one until I try to download it. At that point I get the same error of OutOfRangeInput.
var test3 = new BlobServiceClient("myConnectionString");
var test4 = test3.AccountName;
var test5 = test3.Uri;
var test6 = test3.GetBlobContainerClient("scrapit-job-images");
var test7 = test6.GetBlobClient("profile_photo.jpg");
var test8 = await test7.DownloadAsync();