If you would like to access your file from your own folder img
located in the root of the project instead of the default wwwroot
folder ,you need to configure the Static File Middleware in startup.cs Configure
method like below:
app.UseStaticFiles();// For the wwwroot folderapp.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), "img")), RequestPath = "/img" });app.UseRouting();//other middlewares