The view 'Index' or its master was not found

前端 未结 9 1438
南方客
南方客 2020-12-03 16:03

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         


        
9条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 16:13

    MVC looks for views (like Index) under the views folder but they also have to be under a folder named after their controller (with a few exceptions like partials).

    So this is the structure you want to follow in your project

    Controllers (folder)
        HomeController (.cs)
        AccountController (.cs)
    
    Views (folder)
        Home (folder)
            Index (.cshtml)
        Account (folder)
            Index (.cshtml)
    

提交回复
热议问题