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.