I\'m new to the C# MVC project type and when I created an empty C# MVC project, I noticed the following error:
The view \'Index\' or its master was not found
I had a virtual directory that wasn't correctly referencing the actual directory.
(On Windows) I fixed this by going into IIS (Internet Information Services Manager), and right clicking the virtual directory that wasn't being correctly referenced (In your case, Views
).
Virtual directories will have this little icon next to them:
Right click and then select Manage Virtual Directory
> Advanced Settings
. Ensure the Physical path matches where you think it should be going:
This isn't going to apply to all cases, but it's a possible match for some instances.
I've had this problem a few times before and it can be any of the other answers, but it can also be the Build Action that is causing the issue.
If you right click on the .cshtml/.vbhtml file that you are having a problem with, select Properties, and in the properties window set the Build Action to Content then this can be a solution to your problem.
If you manually deployed the code to an instance of IIS, make sure that the App Pool Identity that is being used to for that application in IIS has rights to the folders in the application.
A good way to diagnose if it's something wrong with your code or something wrong with your IIS settings is to run it in the VS 201X debugger. If it runs there, but won't run under IIS directly, it's a good chance that the App Pool Identity security is jacked up.