In this video I have resolved the following error that you might face while making an application in asp.net mvc and using Razor Pages in your application.
The error is:
System.InvalidOperationException: 'Unable to find the required services. Please add all the required services by calling 'IServiceCollection.AddRazorPages' inside the call to 'ConfigureServices(...)' in the application startup code.'
The solution is very simple:
You need to add
builder.Services.AddRazorPages();
After
builder.Services.AddControllersWithViews();
in your program.cs or startup.cs class.
I am using .net 6.0 so I have only Program.cs class.
In previous versions, like 5.0 or 3.1 you need to add this in startup.cs class.
==================================================
Thanks for watching,
Please subscribe my channel.
==================================================
If you have any questions or queries, write them in comments below
or mail me at:
[email protected]
==================================================
Audio Used in Video:
The Coldest Shoulder
Credits: YouTube free music library
==================================================
Смотрите видео System.InvalidOperationException | IServiceCollection.AddRazorPages | Resolved онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Digital Knack 21 Сентябрь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,590 раз и оно понравилось 48 людям.