Problem Viewing MVC Pages In Visual Studio RRS feed

  • Question

  • User931778073 posted

    When I created a Web API project in Visual Studio 2019, I noticed that along with an MVC Home controller a Web API controller is also created automatically for me. The problem is that when I set the Home/Index page as the starting page and click the play button, it threw an error. The error I got was "The resource cannot be found." I noticed that the path in the address bar is "http://localhost:53399/Views/Home/Index.cshtml".

    However, when I right click on Index.cshtml in the Home folder and select Show in Browser, the path I see in the address bar is "http://localhost:53399/Home/Index" and the page is rendered just fine. My question are is this the correct behavior and am I not suppose to click the play button to display the pages? 

    Monday, January 27, 2020 12:38 AM


  • User931778073 posted

    I know that MVC uses the default route in global.asax files for navigating from view to view and other posted articles on this very error. The problem is the method for fixing this issue isn't applicable to visual studio 2019 so I decided to delete the project and create it again.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 27, 2020 1:39 AM