no parameterless constructor define for type 解決一例


在生成根據模型和上下文生成帶增刪查改操作的視圖的控制器時,提示上述信息,網上查找了資料也沒有解決,突然想起該項目是連接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();

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM