No service for type 'Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory' has been registered

前端 未结 11 808
终归单人心
终归单人心 2021-01-01 08:57

I\'m having this problem: No service for type \'Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory\' has been registered. In asp.net core 1.0,

11条回答
  •  别那么骄傲
    2021-01-01 09:05

    Right now i has same problem, I was using AddMcvCore like you. I found error self descriptive, as an assumption I added AddControllersWithViews service to ConfigureServices function and it fixed problem for me. (I still use AddMvcCore as well.)

        public void ConfigureServices(IServiceCollection services)
        {
            //...
            services.AddControllers();
            services.AddControllersWithViews();
            services.AddMvcCore();
            //...
        }    
    

提交回复
热议问题