设置后,wwwroot下面的文件及子文件夹中的文件都可以下载
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseStaticFiles(new StaticFileOptions() { ServeUnknownFileTypes = true, FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")),//wwwroot相当于真实目录 RequestPath = new PathString("/src") //src相当于别名,为了安全 }); }