在生成根據模型和上下文生成帶增刪查改操作的視圖的控制器時,提示上述信息,網上查找了資料也沒有解決,突然想起該項目是連接MSSQL數據庫和Redis數據庫的,並且已經依賴注入了,而Redis數據庫的服務器卻因故關閉了,把Redis的注入注釋了就正常生成了。
services.AddDbContext<CustomDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
//.AddDefaultUI(UIFramework.Bootstrap4)
.AddEntityFrameworkStores<CustomDbContext>();
services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Latest);
//services.AddSingleton<IConnectionMultiplexer>(ConnectionMultiplexer.Connect("10.0.0.7"));
services.AddControllersWithViews();
