The API is using .NET Core 3.1 and the folder structure is as follows:
Solution
--Project1
--Project2
Where Project 2 depends on Project 1 and is the entry point.
The API is hosted on kubernetes and a NFS share is mounted at /storage. The API will need to retrieve and serve files in this file share. So what I did was using the following in my startup.cs in Project2:
app.UseFileServer(new FileServerOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"storage")),//this will return /app/storage
RequestPath = new PathString("/resources")
});
I know one of the file is there by checking:
System.IO.File.Exists(@"/app/storage/test.JPG");
However, when I tried to access the file by going to http://myapiurl/resources/test.JPG, I always got a 404 not found.
I was wondering what I was missing?