I am getting an error as "The specified resource name length is not within the permissible limits" when I try to upload a blob to my Azure Storage Account
.
Below is my code.
private async Task UploadToAzureBlobStorage(string path, string fileName) {
try {
if (CloudStorageAccount.TryParse(StorageConnectionString, out CloudStorageAccount cloudStorageAccount)) {
var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
var cloudBlobContainer = cloudBlobClient.GetContainerReference(path);
var cloudBlockBlob = cloudBlobContainer.GetBlockBlobReference(fileName);
await cloudBlockBlob.UploadFromFileAsync(path);
}
else {
throw new CustomConfigurationException(CustomConstants.NoStorageConnectionStringSettings);
}
}
catch(Exception ex) {
throw new CustomConfigurationException($ "Error when uploading to blob: {ex.Message}");
}
}
Anyone else have faced this same issue?