Home [C# 筆記] InvalidOperationException: The view 'Index' was not found. The following locations were searched
Post
Cancel

[C# 筆記] InvalidOperationException: The view 'Index' was not found. The following locations were searched

錯誤訊息

InvalidOperationException: The view ‘Index’ was not found. The following locations were searched

All the archovios are created and in the right place.

解決方法

  1. Go to your project solution –> Right click and add nuget Packages
    called Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation install this.

  2. Add one line on Programm.cs file
    i.e “builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();

https://stackoverflow.com/questions/75808380/invalidoperationexception-the-view-index-was-not-found-the-following-locatio

This post is licensed under CC BY 4.0 by the author.