For my unit tests I want to use Azurite to create & verify BLOBs. The instructions only show how to do this for an ASP.NET app. How can I do it for a command line app?
I tried running Azurite from the command line and got this error:
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator>azuri
te
Azurite Blob service is starting at http://127.0.0.1:10000
Exit due to unhandled error: Error: EPERM: operation not permitted, open 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator\__azurite_db_blob__.json~'
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator>
Update: And now I'm getting the following. My Blazor app is not presently running, but was 30 minutes ago.
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator>azurite
Azurite Blob service is starting at http://127.0.0.1:10000
Exit due to unhandled error: listen EADDRINUSE: address already in use 127.0.0.1:10000
C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator>
And now my unit tests run and can hit Azurite. So it looks like running it from my Blazor app starts it and keeps it running. So that is a solution.
But is there a way to have the command line app start it up if needed?
My configuration is (so shouldn't need any credentials):
"AzureStorageKey": "UseDevelopmentStorage=true",
"ConnectionStrings": {
"AzureStorage": "UseDevelopmentStorage=true"
},
Note: Azurite is running fine automatically starting when I run my Blazor app from Visual Studio.
Even I got the same error when I run the
azuritefrom the path which you have mentioned.Thank you @Gaurav Mantri for the comments.
From this MSDoc, it is clear that no need to go to the
Azure Storage Emulatorpath to runazurite.Open the CMD, run the command
azurite.exealong with the path as shown below.As I am using the Community edition, I have copied the path of it.
With Professional Edition:
I have tried the same by opening the command prompt as an Administrator as well.
I got the same output.
As mentioned in the doc, I even tried with the temp path as well.
No need to go to the Azure Storage Emulator path and run
azurite.Instead open the command prompt and run the
azurite.exealong with complete path.In your case, run
If one instance is running and you run the same command again in new instance, you will get this error.
I have opened the new cmd prompt and executed the same command again, even I got the same error.