Lab: Create ASP.NET Web App
Introduction
In this lab, you will create a .NET Core Web application using the command line. This app will be used for future labs.
Duration: 10-20 minutes
Instructions
Step 1: Open Command Prompt and Create Project Directory
- Open a command prompt or terminal window.
-
Create a new directory for the project by running the following command:
mkdir WebApp
-
Navigate into the newly created directory:
cd WebApp
Step 2: Create a New .NET Core Web Application
-
In the command prompt, create a new .NET Core Web application by running:
dotnet new webapp
This will generate a basic ASP.NET Core Web application.
Step 3: Run the Application
-
After the application is created, run it using the following command:
dotnet run
-
The application will start and listen on a local port. You should see output indicating that the application is running.
Step 4: Open the Application in a Browser
- Open a web browser of your choice.
-
Navigate to the URL
https://localhost:5001
to view the application.Note: The port number may vary. If you see a different port number in the output from
dotnet run
, use that number instead. - You should see the default .NET Core Web application in your browser.
Step 5: Stop the Application
- Once you’re done viewing the application, stop it by pressing
Ctrl+C
in the command prompt. This will terminate the application.
Step 6: Commit the Source Code to the Repository
- Open your repository where you want to save the project.
- Commit the source code of the application. For this lab, you can save the source code in a
src/dotnet
directory.
Summary
In this lab, you successfully created a .NET Core Web application using the command line. You also ran the application locally in your browser. This application will be used in future labs.