ASP.NET Core can serve static files—images, stylesheets, JavaScript scripts, and text—and it even respects filesystem folders. This is useful because they are extremely important as not all content is generated on the fly. Let's first focus on their configuration.
Configuration
The default template in Visual Studio includes the Microsoft.AspNetCore.StaticFiles NuGet package, which is also included in the Microsoft.AspNetCore.All metapackage. Also, the code to initialize the host—Kestrel or HTTP.sys—defines the root folder of the applicationas the root folder for serving static files (such as HTML, JavaScript, CSS, and images), as returned byDirectory.
This is .GetCurrentDirectory(), but you can change that in the Program class, where the host is initialized, by using UseContentRoot:
publicstaticIHostBuilderCreateHostBuilder(string[] args)
{ Host.CreateDefaultBuilder(args)...