2

After cleaning up the Azurite folder and restarting my .Net 6 Azure Functions ~4 projects, I get the following error:

Azure.RequestFailedException: 'Service request failed.
Status: 404 (The specified container does not exist.)
ErrorCode: ContainerNotFound

Headers:
Server: Azurite-Blob/3.18.0
x-ms-error-code: ContainerNotFound
x-ms-request-id: 94748aff-d2c2-492f-af58-9876fbab8338
Date: Thu, 25 Aug 2022 08:03:14 GMT
Connection: keep-alive
Keep-Alive: REDACTED
'

My Local.settings.json configuration is set to use the local development storage:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureWebJobsSecretStorageType": "files"
  }
}

Nothing has changed in my project. This is an internal error coming from BlobLeaseDistributionManager.cs.

While it can connect to my local Azurite installation properly, it complains that the container does not exist. Is there a way to create this container or maybe a different solution?

Erçin Dedeoğlu
  • 4,950
  • 4
  • 49
  • 69
Norbert Huurnink
  • 1,326
  • 10
  • 18
  • You need to take a look at the Azurite logs to see which request is causing this. Probably the easiest way is to just start Azurite standalone, as in this mode request logs are being written to the console. – Simon Sep 12 '22 at 20:06

4 Answers4

5

Check your exception settings in Visual Studio.

I had Common Language Runtime Exceptions on.

The exception is by design, and actually, it will throw lots of times. So you can either mash the continue button, or you can reset these to default.

Once you power through the exceptions, everything sets up correctly.

Thanks to @Noppey for his comment above that led me to find this solution.

NibblyPig
  • 51,118
  • 72
  • 200
  • 356
4

I found a solution here that worked for me when I got this error.

The error most likely means something has corrupted your local Azurite storage.

  1. Exit all Visual Studio and Azurite processes
  2. Go to C:\Users\Username\AppData\Local\Temp (Either replace Username with your own username or type %APPDATA% to go to the folder quickly)
  3. Rename the Azurite folder to AzuriteOld or delete it
  4. Start your project and the Azure Function
  5. A new Azurite folder will be created and it should now connect properly
Thom
  • 663
  • 7
  • 19
  • 1
    That's interesting, in my project the exception is actually triggered by renaming the Azurite folder, as it can't find the container anymore after that. – Norbert Huurnink Sep 16 '22 at 13:56
0

The most likely issue here is that:

After cleaning up the Azurite folder and restarting my .Net 6 Azure Functions ~4 projects...

What you've done is deleted the container.

Assuming you're using the Azure SDK, try something like:

  var client = new BlobContainerCient(
  new Uri("https://127.0.0.1:10000/devstoreaccount1/container-name"), 
  new DefaultAzureCredential()
     );

Obviously you'll need to replace the Uri with whichever values you're using. And you'll need to ensure your certificate for Azurite is trusted by your user or machine, otherwise do not use the https scheme, use http (TLS disabled - not good for production but MS will provide a trusted cert for production storage accounts).

Architect Jamie
  • 1,621
  • 4
  • 18
-2

This error says container not found. you do not type the correct blob name or maybe change it on the server side.

Blob's name is images

enter image description here

but I try with the image1 blob name. this is my local.settings.json file

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=blobaccount897896;AccountKey=xxxxxxxx;EndpointSuffix=core.windows.net",
    "ContainerName": "images1", // Container name
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}

output: ContainerNotFound as you show in snippet images enter image description here

After I correct the blob container name.

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=blobaccount897896;AccountKey=xxxxx;EndpointSuffix=core.windows.net",
    "ContainerName": "images", // Container name
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}

Post-man output. enter image description here

Output enter image description here

On Azure portal successfully file uploaded. enter image description here