/* 0 public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() //.UseWebRoot("files") 設置默認文件夾 ; */ //app.UseStaticFiles();//一、使用默認文件夾wwwroot //app.UseStaticFiles(new StaticFileOptions //{ // FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "files")), // RequestPath = "/Files" //});//二、開啓其餘默認文件訪問 ////三、查看指定目錄 //app.UseDirectoryBrowser(new DirectoryBrowserOptions { // FileProvider= new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "files")), // RequestPath="/files/dir" //}); app.UseDefaultFiles(new DefaultFilesOptions { DefaultFileNames = new List<string> { "index.html" } }); //UseFileServer=UseDefaultFiles+UseStaticFiles+UseDirectoryBrowser app.UseFileServer(true);//四、開啓默認【訪問以及目錄查看】 app.UseFileServer(new FileServerOptions { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "files")), RequestPath = "/Files", EnableDirectoryBrowsing = true, });//五、開啓指定目錄【訪問以及查看】