To use static file, you must Add Microsoft.AspNetCore.StaticFiles
to the request pipeline of asp.net core
Basic information configuration
The following code shows how to configure the static file Middleware in startup.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseStaticFiles();
}
Still dot net core routing not allowed you to access static folder content untill you configure your folder/directory path. following below link will help you to access this
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(),
@"/StaticFiles")),
RequestPath = new PathString("/StaticFiles")
});
}
Now you can access your static file url through browser