gebeurtenis
Power BI DataViz World Championships
14 feb, 16 - 31 mrt, 16
Met 4 kansen om in te gaan, kun je een conferentiepakket winnen en het naar de LIVE Grand Finale in Las Vegas maken
Meer informatieDeze browser wordt niet meer ondersteund.
Upgrade naar Microsoft Edge om te profiteren van de nieuwste functies, beveiligingsupdates en technische ondersteuning.
Notitie
This isn't the latest version of this article. For the current release, see the .NET 9 version of this article.
Waarschuwing
This version of ASP.NET Core is no longer supported. For more information, see the .NET and .NET Core Support Policy. For the current release, see the .NET 9 version of this article.
Belangrijk
This information relates to a pre-release product that may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
For the current release, see the .NET 9 version of this article.
This tutorial shows how to create and run an ASP.NET Core web app using the .NET CLI.
For Blazor tutorials, see ASP.NET Core Blazor tutorials.
You'll learn how to:
At the end, you'll have a working web app running on your local machine.
Open a command shell, and enter the following command:
dotnet new webapp --output aspnetcoreapp --no-https
The preceding command creates a new web app project in a directory named aspnetcoreapp
. The project doesn't use HTTPS.
Run the following commands:
cd aspnetcoreapp
dotnet run
The run
command produces output like the following example:
Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5109
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\aspnetcoreapp
Open a browser and go to the URL shown in the output. In this example, the URL is http://localhost:5109
.
The browser shows the home page.
Change the home page:
In the command shell, press Ctrl+C (Cmd+C in macOS) to exit the program.
Open Pages/Index.cshtml
in a text editor.
Replace the line that begins with "Learn about" with the following highlighted markup and code:
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Hello, world! The time on the server is @DateTime.Now</p>
</div>
Save your changes.
In the command shell run the dotnet run
command again.
In the browser, refresh the page and verify the changes are displayed.
In this tutorial, you learned how to:
To learn more about ASP.NET Core, see the following:
ASP.NET Core-feedback
ASP.NET Core is een open source project. Selecteer een koppeling om feedback te geven:
gebeurtenis
Power BI DataViz World Championships
14 feb, 16 - 31 mrt, 16
Met 4 kansen om in te gaan, kun je een conferentiepakket winnen en het naar de LIVE Grand Finale in Las Vegas maken
Meer informatieTraining
Module
Uw eerste ASP.NET Core-web-app bouwen - Training
Meer informatie over het bouwen van uw eerste web-app met behulp van ASP.NET Core.
Certificering
Bouw end-to-end-oplossingen in Microsoft Azure om Azure Functions te maken, web-apps te implementeren en te beheren, oplossingen te ontwikkelen die gebruikmaken van Azure Storage en meer.
Documentatie
Overzicht van basisinformatie over ASP.NET Core
Meer informatie over de basisconcepten voor het bouwen van ASP.NET Core-apps, waaronder afhankelijkheidsinjectie (DI), configuratie, middleware en meer.
Zelfstudie: Aan de slag met Razor Pagina's in ASP.NET Core
Dit is de eerste zelfstudie van een reeks die de basisbeginselen leert van het bouwen van een ASP.NET Core Razor Pages-web-app.