Hi,@Boucourt I reproduced the error,it has no relationship with EFCore:
I think you've got mixed WebApi app with MVC app ,If you want to retrun ViewResult with return View()
You should try with a MVC app
If you just want add a scaffolded api controller in Webapi project,please try with the following options:
and the error indicates lacking required service for MVC parttern,if you insist on mixing webapi with mvc,you have to call builder.Services.AddControllersWithViews();
to regist required service in Program.cs
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
RuikaiFeng