GithubHelp home page GithubHelp logo

Comments (3)

markjprice avatar markjprice commented on May 2, 2024

If you are getting that error saying that it cannot find /Views/Home/Customers.cshtml then you either have not completed Step 4, as shown in the screenshot below, or you have created a Razor Page instead of a Razor View.
image
Did you put a @page at the top of the file contents? If so, remove it.

from cs11dotnet7.

markjprice avatar markjprice commented on May 2, 2024

You might find the following useful:
https://github.com/markjprice/cs11dotnet7/blob/main/docs/errata/improvements.md#page-533---building-websites-using-aspnet-core

from cs11dotnet7.

johntempest avatar johntempest commented on May 2, 2024

I did manage to get Northwind.Mvc to display the customers for the selected country as indicated in the 7e book. But then I did the tasks in the optional part of the chapter detailed in the GitHub pages. Then after trying out displaying the customers again, I encountered the same unhandled exception of not finding the Customers view in any of the three places indicated. I put a breakpoint in the HomeController.cs code where the HTTpClient is created for Northwind.WebApi. The exception occurred after the response was received from the Northwind.WebApi server (all the customer details were shown on the terminal window for that server). I could only assume that the "model" after being processed by the ".ReadFromJsonAsync<IEnumerable>()" did not somehow fit with the structure of the Customers.cshtml file. I then checked the Customers.cshtml file character by character with the code in the repository compared to my code - to no avail. Eventually I decided to replace the code in my file with the repository version of the Customers.cshtml and Northwind.Mvc.csproj files using cut and paste of the complete files. This seems to have cleared the problem. It may be possible that my Customers.cshtml file may have had some hidden character in it which effectively corrupted the file. This seems to be the only explanation for the exception occurring even though I spent many hours comparing my code with that in the repository.
I have now completed Chapter 15 of the 7th edition and am proceeding to Chapter 16.

from cs11dotnet7.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.