System.InvalidOperationException: The view 'Index' was not found. The following locations were searched


Question: How do you resolve this error "System.InvalidOperationException: The view 'Index' was not found. The following locations were searched:" 


Login to See the Rest of the Answer

Answer:
This can be a painful error to diagnose, follow instruction below to make sure that you are not making known mistakes.

1. If you're seeing this error in Production and you use Docker to host your application make sure:

    a. The image you're using to host the application is correct. For Example, Images that run on Linux are different in archtecture than those that run on Windows. 
    Verify that the correct image is getting pulled.

   b. If You are still stuck and you have verified that the Docker Image is correct or the right one, then make sure that when 
       you build a new Image that you specify --pull see the code below:
        docker-compose build --pull YourServiceName # This will force Docker Engine to pull the image in case it is using a chached Runtime.

 c. Make sure you update the the Base System that Docker Engine is running on.

2. If you are seeing this error on the Development Machine, follow instruction below:
   
  a. Make sure that Visual Studio 2022 is up to date
  b. Check how many versions of Asp.Net Runtimes is installed on your machine. Sometimes, the Application might be using an outdated version.

Check the installed dotnet version by using this command : dotnet --list-runtimes 

c. If you updated the Asp.Net Runtime from the Command line there is a chance that you need to update the Visual Studio to bring Visual Studio 2022 uptodate (Make it aware of the updated SDK's and Runtimes)

d. After all the above have been verified, build and publish, make sure that all Files and folders are present in the published folder otherwise the culprit will be in the plain-sight (meaning the solution could be simple, the Views could just not be found because you might have placed them in a wrong folder).


Did this solution help you? if yes leave a comment below letting others know how you resolved it. 
 








For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email Address[email protected]