Reference: https: //jingyan.baidu.com/article/6079ad0e3e212168fe86db75.html
Add in the Configure Startup.cs
app.UseFileServer();
Example:
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?}"); }); }
Note: This position is currently not studied enough code should be just on the line