Nuget 引入:Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
Startup.cs文件
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddSession();
//1.Nuget安装:Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
//2.配置
services.AddRazorPages().AddRazorRuntimeCompilation();
}