The view or it's master was not found, but it exists

asp.net-mvc, asp.net-mvc-3, vb.net

Solution

Check that Visual Studio is actually publishing the file to the remote web server. If the file is not included in the solution or if the build action has been changed from 'Content' mistakenly, then the file will not exist on the server.

Problem

I have read The view 'Whatever' or its master could not be found and ASP.NET MVC The view 'name' or its master was not found but I cannot find the solution to my problem. The file exists in the directory, but it says it does not: The view 'GetLastArticle' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/Article/GetLastArticle.aspx ~/Views/Article/GetLastArticle.ascx ~/Views/Shared/GetLastArticle.aspx ~/Views/Shared/GetLastArticle.ascx ~/Views/Article/GetLastArticle.cshtml ~/Views/Article/GetLastArticle.vbhtml ~/Views/Shared/GetLastArticle.cshtml ~/Views/Shared/GetLastArticle.vbhtml It points to this line of the following code: `@Html.Action("GetLastArticle", "Article")` ``` @Code ViewData("Title") = "Home Page" End Code <h2>My Blog <span>news</span></h2> <div class="info_box_holder fltleft"> @Html.Action("GetLastRssItem", "Rss", New With {.url = "http://rss.ew.com/web/ew/rss/todayslatest/index.xml"}) @Html.Action("GetLastRssItem", "Rss", New With {.url = "http://www.eonline.com/syndication/feeds/rssfeeds/movies.xml"}) </div> <div class="info_box_holder fltleft"> @Html.Action("GetLastArticle", "Article") @Html.Action("GetLastRssItem", "Rss", New With {.url = "http://rss.news.yahoo.com/rss/entertainment"}) </div> ``` Here is my action that I am calling and getting the error on: ``` Function GetLastArticle() As ActionResult Dim models = db.Articles.OrderByDescending(Function(a) a.DateCreated) Dim model = New Article If models.Any Then model = db.Articles.OrderByDescending(Function(a) a.DateCreated).First Else model.DateCreated = Date.Today model.Title = "Latest article not found" model.Body = "The latest article was not found." End If Return View(model) End Function ``` The site works fine on localhost, but when I publish, I get the error. How can I fix this?

Original source

Related problems