I have a Azure App service (Linux) with a mounted local share from an Azure storage blob container. I followed the guide on this page. When I try to access a file in the local share via http, I get a HTTP ERROR 404. The url is https://cid-linux-storage.azurewebsites.net/media/naa.jpg.
The storage mount has the following properties;
In the SSH terminal, the storage mount is accessible.
The mount are also visible when browsing the site in Kudu.
Edited: App Service config
The blob container is set to an anonymous access level.
I applied a similar method using a Windows app service and a file share, and it was successful. For this site, I would prefer to adopt a Linux/Blob container approach.
My Linux skills are quite limited, and there might be a simple solution to my problem. I would appreciate any help.
Even I am unable to access the Images directly from the folder. I have even tried by uploading the images manually.
Check the below workaround to access Images ( or any static files) from the Subfolder which is in the wwwroot
directory.
Program.cs
, by default the app serves the Staticfiles, you can see UseStaticFiles
.I have taken references from MSDoc,
To access the files from the subfolder(media in your case), modify the code as below.
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(builder.Environment.ContentRootPath, "media")),
RequestPath = "/media"
});
Deploy the Web App to the same Azure Linux App Service where you have uploaded files.
Now you can access the files directly.
https://testapp29july.azurewebsites.net/media/foster-lake.jpg
Output: