The view 'Index' or its master was not found.

后端 未结 17 2206
逝去的感伤
逝去的感伤 2020-12-15 14:42
The view \'Index\' or its master was not found. The following locations were searched:
~/Views/ControllerName/Index.aspx
~/Views/ControllerName/Index.ascx
~/Views/Sh         


        
相关标签:
17条回答
  • 2020-12-15 15:36

    This error can also surface if your MSI installer failed to actually deploy the file.

    In my case this happened because I converted the .aspx files to .cshtml files and visual studio thought these were brand new files and set the build action to none instead of content.

    0 讨论(0)
  • 2020-12-15 15:38

    You most likely did not create your own view engine.
    The default view engine looks for the views in ~/Views/[Controller]/ and ~/Views/Shared/.

    You need to create your own view engine to make sure the views are searched in area views folder.

    Take a look this post by Phil Haack.

    0 讨论(0)
  • 2020-12-15 15:41

    I have had this problem too; I noticed that I missed to include the view page inside the folder that's name is same with the controller.

    Controller: adminController View->Admin->view1.cshtml

    (It was View->view1.cshtml)(there was no folder: Admin)

    0 讨论(0)
  • 2020-12-15 15:44

    I got the same problem in here, and guess what.... looking at the csproj's xml' structure, I noticed the Content node (inside ItemGroup node) was as "none"... not sure why but that was the reason I was getting the same error, just edited that to "Content" as the others, and it's working.

    Hope that helps

    0 讨论(0)
  • 2020-12-15 15:46
    1. right click in index() method from your controller
    2. then click on goto view

    if this action open index.cshtml?

    Your problem is the IIS pool is not have permission to access the physical path of the view.

    you can test it by giving permission. for example :- go to c:\inetpub\wwwroot\yourweb then right click on yourweb folder -> property ->security and add group name everyone and allow full control to your site . hope this fix your problem.

    0 讨论(0)
提交回复
热议问题