01-文件系统
/* 0 public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() //.UseWebRoot("files") 设置默认文件夹 ; */ //app.UseStaticFiles();//1、使用默认文件夹wwwroot //app.UseStaticFiles(new StaticFileOptions //{ // FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "files")), // RequestPath = "/Files" //});//2、开启其他默认文件访问 ////3、查看指定目录 //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);//4、开启默认【访问以及目录查看】 app.UseFileServer(new FileServerOptions { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "files")), RequestPath = "/Files", EnableDirectoryBrowsing = true, });//5、开启指定目录【访问以及查看】
生活没有输赢,不要在乎别人如何评价你,开心就好。
QQ群:158138959