ASP.NET Core - StaticFiles
使用静态页面作为首页
https://blog.csdn.net/alvachien/article/details/51499550
那,如果需要设置static file (通常是wwwroot文件夹)的文件为default page (这对纯的JavaScript 网站来说非常有必要。static files的使用方法,同样参阅ASP.NET Core的最新文档:https://docs.asp.net/en/latest/fundamentals/static-files.html),
针对最新的ASP.NET Core 1.0 RC2,在Startup.cs中的Configure方法中加入下列代码(替换index.html为任意其他文件):
public void Configure(IApplicationBuilder app) { app.UseStaticFiles(); //var physicalFileSystem = new PhysicalFileSystem(webPath); var options = new FileServerOptions { EnableDefaultFiles = true, //StaticFileSystem = physicalFileSystem }; //options.StaticFileOptions.FileSystem = physicalFileSystem; options.StaticFileOptions.ServeUnknownFileTypes = true; options.DefaultFilesOptions.DefaultFileNames = new[] { "index.html" }; app.UseFileServer(options); }