I struggled with the same problem for several months: this happened to me in only a few looks.
It seems that rendering the views is not as simple as I thought, since MVC needs to do a couple of operations to determine the exact .cshtml to use for the action, its partial views, if you have any, etc. etc.
What work for me was to use the Razor Generator , which processes Razor files during development instead of runtime . (if you want to take a picture, I suggest you try it first so that you know that it takes time to load the first time you try).
From the website:
One reason for this is to avoid any harm at runtime when your site starts up, since there is nothing to compile at runtime. This can be significant on sites with many kinds.
The disadvantage of implementing Razor Generator is that you no longer need .cshtml files: therefore, if you want to change the view, you need to recompile the project. But this is not a problem, at least not for me.
First install the razor generator from the VS extension gallery (as described on the website), and then the nuget package.
Trust me: you'll be so glad you cry βΊ
source share