Error: Unable to Find View File

Error Message

There will be much more text before and after the actual message, but here is the message below:

System.InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations.

Cause

The MVC view engine knows to look in certain areas when a specific view is requested.  By default, it will be looking for a view named "Index," but this same error may apply to views of other names as well.  Those locations include:

  • The current view folder
  • The shared view folder

Let's assume we're seeing this error in the Products view.  This would make the above locations be similar to what you see below:

  • ~\Portals\_default\HotcakesViews\VIEWSETNAME\Views\Products\
  • ~\Portals\_default\HotcakesViews\VIEWSETNAME\Views\Shared\

Resolution

The view is not found in the expected locations.  It either needs to be placed there, or there is an issue with MVC caching.

Expected View File Doesn't Exist or Exists in the Wrong Place

In this case, either the view and/or it's folder doesn't exist at all, or you may be structured your view folders in an unexpected way.

If your views are missing, this should be fairly easy to detect.  Simply compare a site that's working to one that isn't.  You can also compare your viewset folder to the _default viewset folder.

In some cases, it might be a bit more difficult to detect when/if a viewset folder structure is in the wrong place.  This usually happens when you package and upload your viewset.  The resolution here is the same though.  Compare the folder structure to ensure that it matches.

MVC Version is Cached

In some instances, it's actually your web server getting in the way.  You'll usually only see this after initially installing or upgrading Hotcakes.  Any other time, the issue is much more likely to be the one mentioned above.

If your MVC version is cached, it will be necessary to clear that cache.  So far, there's only one know way to consistently do this.

  1. First, download the latest PDB files.  If you don't see your version there, you will need to request your version via a support request.
  2. Unzip the PDB files from the zip file you just downloaded, and copy them into the ~\Bin folder of your website.
  3. View the page(s) that were throwing the error.

If this is the cause of the issue, the errors will now be gone.

IMPORTANT:  Please remember to delete any PDB files you just added.  The error should not return.

Have more questions? Submit a request

Need More Help?

Do you need more assistance with this article? Please review your support options.