解决方案:
Startup.cs
方法-ConfigureServices 添加代码
services.AddDistributedMemoryCache(); services.AddSession();
方法-Configure 添加代码
app.UseSession();