Running Our Website2:00 with James Churchill
Let’s learn how to run our website using Visual Studio so we can preview it in a browser.
To follow along commiting your changes to this course, you'll need to fork the aspnet-comic-book-gallery repo. Then you can clone, commit, and push your changes to your fork like this:
git clone <your-fork> cd aspnet-comic-book-gallery git checkout tags/v1.5 -b running-our-website
For more information about debugging, profiling, and build configurations in Visual Studio check out these articles.
- Debugging in Visual Studio
- Visual Studio 2015 - Analyze Performance While Debugging in Visual Studio 2015
- Understanding Build Configurations
F5- Start debugging (i.e. build and run your website/project)
To run our website we'll click on the Play button at the top of the screen. 0:00 If you prefer to keep your hands on the keyboard, like I do, 0:04 you can also press the F5 function key. 0:07 Before we do that, let's click the little down triangle on the right-hand 0:10 side of the Play button to display a list of the installed browsers. 0:14 Using this list, we can select the browser that we want to use to run our website. 0:18 Let's select Google Chrome and then click the Play button. 0:22 Visual Studio will build our website and load it into the browser that we selected. 0:26 Uh-oh, we got a resource cannot be found error. 0:31 We can also see the HTTP status code along with a detailed description of the error. 0:35 Let's switch back to Visual Studio. 0:41 Notice how our environment has changed. 0:43 The output panel has been replaced with the Autos and 0:45 Call Stack panels, both of which are used for debugging. 0:48 We also have a new panel being displayed, the Diagnostic Tools panel. 0:52 We're not going to use the Diagnostic Tools during this course. 0:57 Click the pin here in the right-hand corner to safely collapse this panel. 1:00 To stop our application, click the Stop button. 1:04 Our website has stopped running and 1:08 our environment returns back to what it was before. 1:10 So why did we get the error? 1:13 Typically, a 404 error means that you're requesting a page that doesn't exist. 1:15 If we look at our project in the Solution Explorer panel, 1:20 we don't see any HTML files or anything that looks like an HTML page. 1:24 Turns out that NVC websites don't use HTML files to represent pages. 1:30 Instead a page is represented by the combination of the controller and a view. 1:36 Since our empty project doesn't contain any controllers or views, 1:42 we don't have a default or home page which resulted in the 404 error. 1:46 Sounds like we need to add a controller and view to our website. 1:52 In the next section, we'll do exactly that. 1:55 See you then. 1:59
You need to sign up for Treehouse in order to download course files.Sign up