I’m running Azure blob storage by Aspire
var builder = DistributedApplication.CreateBuilder(args);
var blobs = builder.AddAzureStorage("storage")
.RunAsEmulator()
.AddBlobs("blobs");
builder. Build().Run();
var objectStorageApi = builder.AddProject<Projects.ObjectStorage_Api>("ObjectStorageApi")
.WithReference(blobs);
the problem is when my client creates a blob container or something to the blob
it gave me this error
C:/Users/Regestea/source/AnswerMe/Services/ObjectStorage/ObjectStorage.Api/bin/Debug/net8.0/ObjectStorage.Api.exe
2024-06-17T15:12:12.8261824info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:4323
2024-06-17T15:12:12.8305063info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:4324
2024-06-17T15:12:12.8311811info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
2024-06-17T15:12:12.8317881info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
2024-06-17T15:12:12.8318123info: Microsoft.Hosting.Lifetime[0]
Content root path: C:UsersRegesteasourceAnswerMeServicesObjectStorageObjectStorage.Api
]0;C:UsersRegesteasourceAnswerMeServicesObjectStorageObjectStorage.ApibinDebugnet8.0ObjectStorage.Api.exe
2024-06-17T15:13:42.8515374 info: Azure.Core[1]
Request [d84de2e6-ceba-46e9-acf4-b2c42479ac2c] PUT http://127.0.0.1:4308/devstoreaccount1/name?restype=container
x-ms-blob-public-access:blob
x-ms-version:2024-05-04
Accept:application/xml
x-ms-client-request-id:d84de2e6-ceba-46e9-acf4-b2c42479ac2c
x-ms-return-client-request-id:true
User-Agent:azsdk-net-Storage.Blobs/12.20.0 (.NET 8.0.5; Microsoft Windows 10.0.22631)
x-ms-date:Mon, 17 Jun 2024 11:43:42 GMT
Authorization:REDACTED
client assembly: Azure.Storage.Blobs
2024-06-17T15:13:42.9205547 warn: Azure.Core[8]
Error response [d84de2e6-ceba-46e9-acf4-b2c42479ac2c] 400 The API version
2024-05-04 is not supported by Azurite. Please upgrade Azurite to latest version
n and retry. If you are using Azurite in Visual Studio, please check you have ins
stalled latest Visual Studio patch. Azurite command line parameter "--skipApiVers
sionCheck" or Visual Studio Code configuration "Skip Api Version Check" can skip
this error. (00.1s)
Server:Azurite-Blob/3.29.0
x-ms-error-code:InvalidHeaderValue
x-ms-request-id:89a09e25-022a-49e5-82ac-42d7b8381a29
Date:Mon, 17 Jun 2024 11:43:42 GMT
Connection:keep-alive
Keep-Alive:REDACTED
Transfer-Encoding:chunked
Content-Type:application/xml
I know how to solve it in the docker by command: "azurite --skipApiVersionCheck"
so I don’t know how to skip it in Aspire, maybe there is some way to execute a command like docker or it has some option which I can’t see it
2
Answers
you can add image tag to skip problem like this and inside
WithImageTag()
put the last version of azuriteyou have different choices.
To pass argument to the container, you need to pass the full chain and not only additional argument.
So you can use :
RunAsEmulator(r=>r.WithArgs("azurite", "-l", "/data", "--blobHost", "0.0.0.0", "--queueHost", "0.0.0.0", "--tableHost", "0.0.0.0","--skipApiVersionCheck")).
notice the last element of the array.
(The other element was taken from the DockerFile).
The other choice (could be helpful but this is not answering the original question) is to use the latest image and not the default provided by the Aspire SDK.
For this you can use the following command
.WithImage("azure-storage/azurite", "3.30.0")