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

前端 未结 11 822
终归单人心
终归单人心 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:20

    In .NET Core 3.1, I had to add the following:

    services.AddRazorPages();
    

    in ConfigureServices()

    And the below in Configure() in Startup.cs

    app.UseEndpoints(endpoints =>
    {
         endpoints.MapRazorPages();
    }
    

提交回复
热议问题