asp.net core 设置默认文档index.html
参考:https://jingyan.baidu.com/article/6079ad0e3e212168fe86db75.html
在Startup.cs的Configure添加
app.UseFileServer();
示例:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); //开启index.html app.UseFileServer(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
注:目前这一够代码的位置没研究,应该是随便就行