From the course: ASP.NET Core: Health Checks and Logging

Touring the sample app - ASP.NET Core Tutorial

From the course: ASP.NET Core: Health Checks and Logging

Start my 1-month free trial

Touring the sample app

- [Instructor] Let's have a quick look at the sample application that we will be using throughout this course. The sample app belongs to the H+ Sport brand, a company that among other things, sells a couple of articles for instance, sports clothing, and then some food supplement water, whatever that is, if you haven't heard of that before don't worry, because it's a fictitious company, which is only used within LinkedIn learning courses. There we go. However, this is the well actual, real fake website hplussport.com, but we have a kind of look to copy which is much simpler, but contains functionality. We will be enriching with logging and health checks. The app is relatively simple. It consists of two projects an API project and a web project. Let's have a look at the API project first and there at launch settings, because as you know at least on the fully fledged Windows, visual studio two options to run such an ASP.NET Core app, either by using the built-in web server or by using IIS Express, if you're using visual studio code, only the second option exists, but here we have two options. That means we have settings for IIS Express with these rather high port numbers. And we have the built-in web server settings with these rather low port numbers. The reason for that is that in order to avoid having to run visual studio with an admin account, with admin rights, we have to use an sslPort that's in a certain range and therefore we have different values here. Now, the project as you're getting it is set to use the built in web server. However, if you choose to use IIS Express then you have different port numbers, and that's important because in the web project you will be using JavaScript code to call the API. And the JavaScript code here is referencing a certain port number. You may need to change this. So I deliberately changed this to the IIS Express settings and I will now use the HDPS port, which is used for the built-in web servers, 5101. And I will use that here, by the way the web application has similar launch settings and it runs on local hosts, 5,001 for the application SSL URL, and also in the startup CS of the API project. I have a specific setting which basically tells the server which web application may do a cross domain JavaScript call, again, the ports needs to match. So in that case, let's double-check the settings. That's the API, that's the web application. The web application runs on HTTPS local host 5,001. So I set this to 5,001 and then files you're getting that's exactly the version you will have but if you choose to use IIS Express just rebirth those two settings. Both projects are configured to run with the built-in web server. And I currently only have the web application as start a project so that I was able to show you that. However, and again, that's the version you will be getting in the exercise files. I'm using the multiple startup project setting so that are both run and launched the API and the web application. All right and once this is done, I can hit control F5, and then everything's compiling and they get a prompt to install the SSL certificate which I will be doing. I get this IE6 style security warning. Then everything is starting. You saw that I have the web project coming up and I have this swagger API on the description tool. And you see that the API has a product and point which gives us the list of products. So let's try this out and let's say okay, maybe page one would be a good option for those products. Then I hit execute. And then I get some JSON beg with a couple of products that are part of the application. Now, where do these products come from? They come from the API project and in the API project, we have the app settings JSON file. And here we have a connection string, because I will be using sequel server. The free SQL server express edition is good enough for that. And basically I say on my local system the secret express instance use the database HPlusSport for that API. And the way the code is written that database is filled automatically. So you don't even have to create a database or import a schema or something. That's what the application is doing but you have to have SQL express running, because later we will see what happens if the database doesn't run any longer by the way, database schema, and also the API that's part of this came from my ASP.NET Core, web API calls, which was using exactly that example. And we'll just use that API here so that we have an API that could have some issues and we could use logging and or health checks to find out about those issues. And if you go back to the browser, we see that, okay we now have here a list of products and that list of products came from the API, double check whether you also get that list of products, if not maybe you have different port numbers in your code or incorrect port numbers in your code or you didn't accept the SSL certificate. This could be the two main reasons. If everything fails, just hit F12, have a look it at the Console here. And if something went wrong especially with that JavaScript API call, you will find some information here. However, this looks good. So we are ready to go.

Contents