Tutorial: Get started with ASP.NET Core

This tutorial shows how to use the .NET Core command-line interface to create an ASP.NET Core web app. You'll learn how to:

  • Create a web app project.
  • Enable local HTTPS.
  • Run the app.
  • Edit a Razor page.

At the end, you'll have a working web app running on your local machine.

Web app home page

Prerequisites

Create a web app project

  • Open a command shell, and enter the following command:

    dotnet new webapp -o aspnetcoreapp
    

Enable local HTTPS

  • Trust the HTTPS development certificate:
dotnet dev-certs https --trust

The preceding command displays the following dialog:

Security warning dialog

Select Yes if you agree to trust the development certificate.

Run the app

  • Run the following commands:

    cd aspnetcoreapp
    dotnet run
    
  • Browse to https://localhost:5001. Click Accept to accept the privacy and cookie policy. This app doesn't keep personal information.

Edit a Razor page

  • Open Pages/About.cshtml and modify the page with the following highlighted markup:

    @page
    @model AboutModel
    @{
        ViewData["Title"] = "About";
    }
    <h2>@ViewData["Title"]</h2>
    <h3>@Model.Message</h3>
    
    <p>Hello, world! The time on the server is @DateTime.Now</p>
    
  • Browse to https://localhost:5001/About and verify the changes are displayed.

Next steps

In this tutorial, you learned how to:

  • Create a web app project.
  • Enable local HTTPS.
  • Run the project.
  • Make a change.

To learn more about ASP.NET Core, see the introduction: