The requested name is valid, but no data of the requested type was found while connecting to Azure blob

Ravi 1 Reputation point
2022-10-03T08:11:42.473+00:00

I am getting the 3 Exceptions below when downloading a .csv file from Azure Data lake storage gen 2 from VM machine

Inner Exception 1:
StorageException: The requested name is valid, but no data of the requested type was found.

Inner Exception 2:
HttpRequestException: The requested name is valid, but no data of the requested type was found.

Inner Exception 3:
SocketException: The requested name is valid, but no data of the requested type was found.

Here it is the code I written to download the file

public static string[] downloadContentsFromBlob(string blobAccountName, string blobAccountKey, string containerName, string blobFileName, string blobStoragePath)
{
Console.WriteLine("Inside download contents from Blob()");

   //string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestData/Downloads/");  

   string connectionString = $"DefaultEndpointsProtocol=https;AccountName=" + blobAccountName + ";AccountKey=" + blobAccountKey + ";EndpointSuffix=core.windows.net";  

   // Setup the connection to the storage account  

   CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);  

   // Connect to the blob storage  

   Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient serviceClient = storageAccount.CreateCloudBlobClient();  

   // Connect to the blob container  

   Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container = serviceClient.GetContainerReference($"{containerName}");  

   // Connect to the blob file  

   Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob blob = container.GetBlockBlobReference($"{blobStoragePath + blobFileName}");  


   // provide the file download location below              
   string contents = blob.DownloadTextAsync().Result;  

   Console.WriteLine("Contents from Blob has been Downloaded!");  

   return ConvertStringToStringArray(contents);  

}

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,360 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,457 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,322 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. JimmySalian-2011 41,926 Reputation points
    2022-10-03T08:18:36.863+00:00

    Hi Ravi,

    The Socket error points to some sort of DNS or A Record issue. Chekc the Virtual tags and services service-tags-overview

    246995-image.png

    ==
    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

  2. Ravi 1 Reputation point
    2022-10-04T07:29:06.397+00:00

    Thanks a lot for your reply Jimmy.
    Solution :: Installed Azure storage explorer in VM Machine and tried to access CSV files in Azure blob.
    Got the error while accessing files which was fixed by infra team.
    Then I am able to read Blob storage files using above mentioned code.

    Thanks

    0 comments No comments