Get started with asp

  -  

This tutorial teaches ASP.NET bộ vi xử lý core MVC website development with controllers & views. If you"re new khổng lồ ASP.NET core web development, consider the Razor Pages version of this tutorial, which provides an easier starting point. See Choose an ASP.NET chip core UI, which compares Razor Pages, MVC, và Blazor for UI development.

Bạn đang xem: Get started with asp

This is the first tutorial of a series that teaches ASP.NET vi xử lý core MVC website development with controllers & views.

At the over of the series, you"ll have an tiện ích that manages and displays movie data. You vanphongphamsg.vn how to:


Create a website app.Add and scaffold a model.Work with a database.Add search and validation.

View or tải về sample code (how lớn download).

Prerequisites


The Visual Studio Code instructions use the .NET CLI for ASP.NET core development functions such as project creation. You can follow these instructions on macOS, Linux, or Windows and with any code editor. Minor changes may be required if you use something other than Visual Studio Code.

For Visual Studio for Mac, see the .NET 7 version of this tutorial.


Create a website app


Start Visual Studio & select Create a new project.In the Create a new project dialog, select ASP.NET bộ vi xử lý core Web phầm mềm (Model-View-Controller) > Next.In the Configure your new project dialog, enter MvcMovie for Project name. It"s important to name the project MvcMovie. Capitalization needs to match each namespace when code is copied.Select Next.In the Additional information dialog:Select .NET 8.0 (Preview).Verify that Do not use top-level statements is unchecked.Select Create.

*

For more information, including alternative approaches khổng lồ create the project, see Create a new project in Visual Studio.

Visual Studio uses the default project template for the created MVC project. The created project:

Is a working app.Is a basic starter project.

The tutorial assumes familiarity with VS Code. For more information, see Getting started with VS Code và Visual Studio Code help.

Change lớn the directory (cd) that will contain the project.

Run the following command:

dotnet new mvc -o MvcMoviecode -r MvcMovieIf a dialog box appears with Required assets lớn build và debug are missing from "MvcMovie". địa chỉ cửa hàng them?, select Yes

dotnet new mvc -o MvcMovie: Creates a new ASP.NET bộ vi xử lý core MVC project in the MvcMovie folder.

code -r MvcMovie: Loads the MvcMovie.csproj project file in Visual Studio Code.

For Visual Studio for Mac, see the .NET 7 version of this tutorial.


Run the app


Visual Studio runs the app và opens the mặc định browser.

The address bar shows localhost: & not something lượt thích example.com. The standard hostname for your local computer is localhost. When Visual Studio creates a website project, a random port is used for the website server.

Launching the phầm mềm without debugging by selecting Ctrl+F5 allows you to:

Make code changes.Save the file.Quickly refresh the browser & see the code changes.

You can launch the phầm mềm in debug or non-debug mode from the Debug menu:

*

You can debug the app by selecting the https button in the toolbar:

*

The following image shows the app:

*

Select Ctrl+F5 to lớn run without the debugger.

Trust the HTTPS development certificate by running the following command:

dotnet dev-certs https --trustThe preceding command doesn"t work on Linux. See your Linux distribution"s documentation for trusting a certificate.

The preceding command displays the following dialog, provided the certificate was not previously trusted:

*

For information on trusting the Firefox browser, see Firefox SEC_ERROR_INADEQUATE_KEY_USAGE certificate error.

Visual Studio Code:

Launches a browser.Navigates lớn https://localhost:

.The address bar shows localhost: and not something like example.com. The standard hostname for your local computer is localhost. Localhost only serves web requests from the local computer.

Launching the phầm mềm without debugging by selecting Ctrl+F5 allows you to:

Make code changes.

Save the file.

Quickly refresh the browser and see the code changes.

*

For Visual Studio for Mac, see the .NET 7 version of this tutorial.


Visual Studio help

Visual Studio Code help

Keyboard shortcuts

Visual Studio for Mac help


In the next tutorial in this series, you vanphongphamsg.vn about MVC và start writing some code.


Next: add a controller


This tutorial teaches ASP.NET core MVC web development with controllers & views. If you"re new to lớn ASP.NET vi xử lý core web development, consider the Razor Pages version of this tutorial, which provides an easier starting point. See Choose an ASP.NET bộ vi xử lý core UI, which compares Razor Pages, MVC, & Blazor for UI development.

This is the first tutorial of a series that teaches ASP.NET core MVC web development with controllers & views.

At the over of the series, you"ll have an tiện ích that manages và displays movie data. You vanphongphamsg.vn how to:


Create a web app.Add & scaffold a model.Work with a database.Add tìm kiếm and validation.

View or download sample code (how to download).

Prerequisites


The Visual Studio Code instructions use the .NET CLI for ASP.NET chip core development functions such as project creation. You can follow these instructions on macOS, Linux, or Windows và with any code editor. Minor changes may be required if you use something other than Visual Studio Code.


Create a web app


Start Visual Studio & select Create a new project.In the Create a new project dialog, select ASP.NET vi xử lý core Web app (Model-View-Controller) > Next.In the Configure your new project dialog, enter MvcMovie for Project name. It"s important khổng lồ name the project MvcMovie. Capitalization needs to match each namespace when code is copied.Select Next.In the Additional information dialog:Select .NET 7.0.Verify that Do not use top-level statements is unchecked.Select Create.

*

For more information, including alternative approaches khổng lồ create the project, see Create a new project in Visual Studio.

Visual Studio uses the default project template for the created MVC project. The created project:

Is a working app.Is a basic starter project.

The tutorial assumes familiarity with VS Code. For more information, see Getting started with VS Code và Visual Studio Code help.

Change khổng lồ the directory (cd) that will contain the project.

Run the following command:

dotnet new mvc -o MvcMoviecode -r MvcMovieIf a dialog box appears with Required assets to build và debug are missing from "MvcMovie". Add them?, select Yes

dotnet new mvc -o MvcMovie: Creates a new ASP.NET core MVC project in the MvcMovie folder.

code -r MvcMovie: Loads the MvcMovie.csproj project file in Visual Studio Code.

Start Visual Studio for Mac và select File > New Project....In Visual Studio for Mac select Web and Console > App > Web Application (Model-View-Controller) > Continue.In the Configure your new website Application (Model-View-Controller) dialog:Select .NET 7.0 for the Target Framework.Verify that Do not use top-level statements is unchecked.Select Continue.Enter MvcMovie for Project name. It"s important to lớn name the project MvcMovie. Capitalization needs lớn match each namespace when code is copied.Select Create.

Run the app


Visual Studio runs the app and opens the mặc định browser.

The address bar shows localhost: và not something lượt thích example.com. The standard hostname for your local computer is localhost. When Visual Studio creates a website project, a random port is used for the web server.

Launching the ứng dụng without debugging by selecting Ctrl+F5 allows you to:

Make code changes.Save the file.Quickly refresh the browser & see the code changes.

You can launch the ứng dụng in debug or non-debug mode from the Debug menu:

*

You can debug the app by selecting the https button in the toolbar:

*

The following image shows the app:

*

Select Ctrl+F5 to run without the debugger.

Trust the HTTPS development certificate by running the following command:

dotnet dev-certs https --trustThe preceding command doesn"t work on Linux. See your Linux distribution"s documentation for trusting a certificate.

The preceding command displays the following dialog, provided the certificate was not previously trusted:

*

For information on trusting the Firefox browser, see Firefox SEC_ERROR_INADEQUATE_KEY_USAGE certificate error.

Visual Studio Code:

Launches a browser.Navigates khổng lồ https://localhost:

.The address bar shows localhost: and not something lượt thích example.com. The standard hostname for your local computer is localhost. Localhost only serves website requests from the local computer.

Launching the app without debugging by selecting Ctrl+F5 allows you to:

Make code changes.

Save the file.

Quickly refresh the browser và see the code changes.

*

Select Option+Command+Return to run the tiện ích without the debugger.

Visual Studio for Mac:

Launches a browser.Navigates lớn http://localhost:port, where port is a randomly chosen port number, mix when Visual Studio creates a website project.

Visual Studio for Mac displays the following popup:

*

Select Install and Trust if you trust the development certificate.

The following dialog is displayed:

*

You can launch the phầm mềm in debug or non-debug mode from the Debug menu.

The following image shows the app:

*


Visual Studio help

Visual Studio Code help

Keyboard shortcuts

Visual Studio for Mac help


In the next tutorial in this series, you vanphongphamsg.vn about MVC and start writing some code.


Next: địa chỉ a controller


This tutorial teaches ASP.NET core MVC web development with controllers và views. If you"re new khổng lồ ASP.NET chip core web development, consider the Razor Pages version of this tutorial, which provides an easier starting point. See Choose an ASP.NET core UI, which compares Razor Pages, MVC, & Blazor for UI development.

This is the first tutorial of a series that teaches ASP.NET core MVC web development with controllers & views.

At the kết thúc of the series, you"ll have an app that manages and displays movie data. You vanphongphamsg.vn how to:


Create a web app.Add and scaffold a model.Work with a database.Add search and validation.

View or download sample code (how to download).

Prerequisites


The Visual Studio Code instructions use the .NET CLI for ASP.NET bộ vi xử lý core development functions such as project creation. You can follow these instructions on macOS, Linux, or Windows and with any code editor. Minor changes may be required if you use something other than Visual Studio Code.

For Visual Studio for Mac, see the .NET 7 version of this tutorial.


Create a web app


Start Visual Studio và select Create a new project.In the Create a new project dialog, select ASP.NET vi xử lý core Web app (Model-View-Controller) > Next.In the Configure your new project dialog, enter MvcMovie for Project name. It"s important khổng lồ name the project MvcMovie. Capitalization needs khổng lồ match each namespace when code is copied.Select Next.In the Additional information dialog, select .NET 6.0 (Long-term support).Select Create.

*

For alternative approaches to lớn create the project, see Create a new project in Visual Studio.

Visual Studio uses the mặc định project template for the created MVC project. The created project:

Is a working app.Is a basic starter project.

The tutorial assumes familiarity with VS Code. For more information, see Getting started with VS Code and Visual Studio Code help.

Change lớn the directory (cd) that will contain the project.

Run the following command:

dotnet new mvc -o MvcMoviecode -r MvcMovieIf a dialog box appears with Required assets lớn build và debug are missing from "MvcMovie". địa chỉ cửa hàng them?, select Yes

dotnet new mvc -o MvcMovie: Creates a new ASP.NET chip core MVC project in the MvcMovie folder.

code -r MvcMovie: Loads the MvcMovie.csproj project file in Visual Studio Code.

For Visual Studio for Mac, see the .NET 7 version of this tutorial.


Run the app


Visual Studio runs the app & opens the mặc định browser.

The address bar shows localhost: & not something like example.com. The standard hostname for your local computer is localhost. When Visual Studio creates a website project, a random port is used for the web server.

Launching the tiện ích without debugging by selecting Ctrl+F5 allows you to:

Make code changes.Save the file.Quickly refresh the browser and see the code changes.

You can launch the ứng dụng in debug or non-debug mode from the Debug menu:

*

You can debug the ứng dụng by selecting the MvcMovie button in the toolbar:

*

The following image shows the app:

*

Select Ctrl+F5 to run without the debugger.

Trust the HTTPS development certificate by running the following command:

dotnet dev-certs https --trustThe preceding command doesn"t work on Linux. See your Linux distribution"s documentation for trusting a certificate.

The preceding command displays the following dialog, provided the certificate was not previously trusted:

*

For information on trusting the Firefox browser, see Firefox SEC_ERROR_INADEQUATE_KEY_USAGE certificate error.

Visual Studio Code:

Launches a browser.Navigates to lớn https://localhost:

.The address bar shows localhost: và not something lượt thích example.com. The standard hostname for your local computer is localhost. Localhost only serves website requests from the local computer.

Launching the app without debugging by selecting Ctrl+F5 allows you to:

Make code changes.

Xem thêm: Chu Vi Hình Tròn Lớp 5 - Chu Vi Hình Tròn: Công Thức Và Bài Tập

Save the file.

Quickly refresh the browser & see the code changes.

*

For Visual Studio for Mac, see the .NET 7 version of this tutorial.


Visual Studio help

Visual Studio Code help

Keyboard shortcuts

Visual Studio for Mac help


In the next tutorial in this series, you vanphongphamsg.vn about MVC & start writing some code.


Next: add a controller


This tutorial teaches ASP.NET chip core MVC web development with controllers và views. If you"re new lớn ASP.NET vi xử lý core web development, consider the Razor Pages version of this tutorial, which provides an easier starting point. See Choose an ASP.NET chip core UI, which compares Razor Pages, MVC, & Blazor for UI development.

This is the first tutorial of a series that teaches ASP.NET bộ vi xử lý core MVC web development with controllers and views.

At the end of the series, you"ll have an tiện ích that manages & displays movie data. You vanphongphamsg.vn how to:


Create a web app.Add & scaffold a model.Work with a database.Add tìm kiếm and validation.

View or tải về sample code (how to lớn download).

Prerequisites


The Visual Studio Code instructions use the .NET CLI for ASP.NET core development functions such as project creation. You can follow these instructions on macOS, Linux, or Windows & with any code editor. Minor changes may be required if you use something other than Visual Studio Code.


Create a web app


Start Visual Studio & select Create a new project.In the Create a new project dialog, select ASP.NET bộ vi xử lý core Web Application > Next.In the Configure your new project dialog, enter MvcMovie for Project name. It"s important khổng lồ name the project MvcMovie. Capitalization needs to lớn match each namespace matches when code is copied.Select Create.In the Create a new ASP.NET chip core web application dialog, select:.NET Core & ASP.NET chip core 5.0 in the dropdowns.ASP.NET chip core Web phầm mềm (Model-View-Controller).Create.

*

For alternative approaches to lớn create the project, see Create a new project in Visual Studio.

Visual Studio used the mặc định project template for the created MVC project. The created project:

Is a working app.Is a basic starter project.

The tutorial assumes familiarity with VS Code. For more information, see Getting started with VS Code and Visual Studio Code help.

Change to lớn the directory (cd) that will contain the project.

Run the following command:

dotnet new mvc -o MvcMoviecode -r MvcMovieIf a dialog box appears with Required assets to lớn build and debug are missing from "MvcMovie". địa chỉ them?, select Yes

dotnet new mvc -o MvcMovie: Creates a new ASP.NET bộ vi xử lý core MVC project in the MvcMovie folder.

code -r MvcMovie: Loads the MvcMovie.csproj project tệp tin in Visual Studio Code.

Select File > New Solution.

*

In Visual Studio for Mac earlier than version 8.6, select .NET Core > App > Web Application (Model-View-Controller) > Next. In version 8.6 or later, select Web and Console > App > Web Application (Model-View-Controller) > Next.

*

In the Configure your new web Application dialog:

Confirm that Authentication is set khổng lồ No Authentication.If an option lớn select a Target Framework is presented, select the latest 5.x version.Select Next.

Name the project MvcMovie, and then select Create.

*


Run the app


Select Ctrl+F5 khổng lồ run the phầm mềm without the debugger.

Visual Studio displays the following dialog when a project is not yet configured lớn use SSL:

*

Select Yes if you trust the IIS Express SSL certificate.

The following dialog is displayed:

*

Select Yes if you agree to lớn trust the development certificate.

For information on trusting the Firefox browser, see Firefox SEC_ERROR_INADEQUATE_KEY_USAGE certificate error.

Visual Studio:

Runs the app.

The address bar shows localhost:port# & not something lượt thích example.com. The standard hostname for your local computer is localhost. When Visual Studio creates a web project, a random port is used for the web server.

Launching the tiện ích without debugging by selecting Ctrl+F5 allows you to:

Make code changes.Save the file.Quickly refresh the browser và see the code changes.

You can launch the app in debug or non-debug mode from the Debug thực đơn item:

*

You can debug the phầm mềm by selecting the IIS Express button

*

The following image shows the app:

*

Select Ctrl+F5 khổng lồ run without the debugger.

Trust the HTTPS development certificate by running the following command:

dotnet dev-certs https --trustThe preceding command doesn"t work on Linux. See your Linux distribution"s documentation for trusting a certificate.

The preceding command displays the following dialog, provided the certificate was not previously trusted:

*

For information on trusting the Firefox browser, see Firefox SEC_ERROR_INADEQUATE_KEY_USAGE certificate error.

Visual Studio Code:

Launches a browser.Navigates to https://localhost:5001.

The address bar shows localhost:port:5001 and not something like example.com. The standard hostname for your local computer is localhost. Localhost only serves website requests from the local computer.

Launching the tiện ích without debugging by selecting Ctrl+F5 allows you to:

Make code changes.

Save the file.

Quickly refresh the browser và see the code changes.

*

Select Run > Start Without Debugging to launch the app.

Visual Studio for Mac:

Launches a browser.

You can launch the phầm mềm in debug or non-debug mode from the Run menu.

The following image shows the app:

*


This tutorial teaches ASP.NET core MVC website development with controllers & views. If you"re new khổng lồ ASP.NET bộ vi xử lý core web development, consider the Razor Pages version of this tutorial, which provides an easier starting point. See Choose an ASP.NET core UI, which compares Razor Pages, MVC, & Blazor for UI development.

This is the first tutorial of a series that teaches ASP.NET core MVC web development with controllers và views.

At the kết thúc of the series, you"ll have an phầm mềm that manages and displays movie data. You vanphongphamsg.vn how to:


The Visual Studio Code instructions use the .NET chip core CLI for ASP.NET chip core development functions such as project creation. You can follow these instructions on any platform (macOS, Linux, or Windows) and with any code editor. Minor changes may be required if you use something other than Visual Studio Code. For more information on installing Visual Studio Code on macOS, see Visual Studio Code on macOS.


From the Visual Studio, select Create a new project.

Select ASP.NET chip core Web Application > Next.

*

Name the project MvcMovie và select Create. It"s important khổng lồ name the project MvcMovie so when you copy code, the namespace will match.

*

Select Web Application(Model-View-Controller). From the dropdown boxes, select .NET Core & ASP.NET chip core 3.1, then select Create.

*

Visual Studio used the mặc định project template for the created MVC project. The created project:

Is a working app.Is a basic starter project.

The tutorial assumes familiarity with VS Code. For more information, see Getting started with VS Code and Visual Studio Code help.

Change directories (cd) lớn a folder that will contain the project.

Run the following command:

dotnet new mvc -o MvcMoviecode -r MvcMovieA dialog box appears with Required assets to build và debug are missing from "MvcMovie". địa chỉ cửa hàng them?, select Yes.

dotnet new mvc -o MvcMovie: Creates a new ASP.NET bộ vi xử lý core MVC project in the MvcMovie folder.

code -r MvcMovie: Loads the MvcMovie.csproj project tệp tin in Visual Studio Code.

Select File > New Solution.

*

In Visual Studio for Mac earlier than version 8.6, select .NET Core > App > Web Application (Model-View-Controller) > Next. In version 8.6 or later, select Web and Console > App > Web Application (Model-View-Controller) > Next.

*

In the Configure your new web Application dialog:

Confirm that Authentication is set khổng lồ No Authentication.If an option to select a Target Framework is presented, select the latest 3.x version.Select Next.

Name the project MvcMovie, & then select Create.

*


Select Ctrl+F5 to run the app without debugging.

Visual Studio displays the following dialog when a project is not yet configured to use SSL:

*

Select Yes if you trust the IIS Express SSL certificate.

The following dialog is displayed:

*

Select Yes if you agree lớn trust the development certificate.

For information on trusting the Firefox browser, see Firefox SEC_ERROR_INADEQUATE_KEY_USAGE certificate error.

Visual Studio:

Runs the app.

The address bar shows localhost:port# and not something lượt thích example.com. The standard hostname for your local computer is localhost. When Visual Studio creates a web project, a random port is used for the website server.

Launching the tiện ích without debugging by selecting Ctrl+F5 allows you to:

Make code changes.Save the file.Quickly refresh the browser & see the code changes.

You can launch the phầm mềm in debug or non-debug mode from the Debug menu item:

*

You can debug the tiện ích by selecting the IIS Express button

*

The following image shows the app:

*

Select Ctrl+F5 lớn run the ứng dụng without debugging.

Trust the HTTPS development certificate by running the following command:

dotnet dev-certs https --trustThe preceding command doesn"t work on Linux. See your Linux distribution"s documentation for trusting a certificate.

The preceding command displays the following dialog, provided the certificate was not previously trusted:

*

For information on trusting the Firefox browser, see Firefox SEC_ERROR_INADEQUATE_KEY_USAGE certificate error.

Visual Studio Code:

Launches a browser.Navigates lớn https://localhost:5001.

The address bar shows localhost:port:5001 and not something like example.com. The standard hostname for your local computer is localhost. Localhost only serves web requests from the local computer.

Launching the tiện ích without debugging by selecting Ctrl+F5 allows you to:

Make code changes.

Save the file.

Quickly refresh the browser and see the code changes.

*

Visual Studio for Mac displays the following popup:

*

Select Yes if you trust the development certificate.

The following dialog is displayed:

*

Enter your password and select OK

Select Yes if you agree lớn trust the development certificate.

See Trust the ASP.NET chip core HTTPS development certificate for more information.

Xem thêm: Giải Mã Tri Kỷ - Tri Ky By Mat Ngoc On Amazon Music

The address bar shows localhost:port# & not something lượt thích example.com. The standard hostname for your local computer is localhost. When Visual Studio creates a web project, a random port is used for the web server. When you run the app, you"ll see a different port number.