Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create an ASP.NET Core Web application

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this article, the editor introduces "how to create an ASP.NET Core Web application" in detail, with detailed content, clear steps and proper handling of the details. I hope this "how to create an ASP.NET Core Web application" article can help you solve your doubts.

Create an ASP.NET Web application

Open the installed VisualStudio 2019 and click "create New Project", as shown below.

When you click the create New Project box, it opens the create New Project window. This window includes different .NET Core 3.1 application templates.

Here, we will create a simple Web application, so select the ASP.NET Core Web application template and click the next button, as shown in the following figure.

Clicking "next" will open the following "configure New Project" window, which requires settings for the project we created: the project name, the path where the project is stored, and the name of the solution.

In this example, we will name the HelloAspNetCore application, and then click the create button, as shown in the following figure.

When you click the create button, it opens create an ASP.NET Web application, as shown below.

Here, you need to select the appropriate ASP.NET Web application template, such as null, API, Web application, Web application (MVC), Angular, and so on.

In this example, we will use the "empty" template so that you can understand how different components fit together to develop a core ASP.NET application.

In addition, make sure that you select the appropriate .NET core and ASP.NET version (the latest 3.1). Make sure that all check boxes in the Advanced section are unchecked, and then click the create button, as shown in the following figure.

When you click the create button, it creates an ASP.NET Core Web project.

Wait a while until Visual Studio restores the package in the project.

The restore process means that Visual Studio will automatically add, update, or delete NuGet packages configured in the project.

The project will be created in Visual Studio 2019 using the following file and folder structures.

Run the ASP.NET Core Web application:

To run this Web application, click IIS Express or press F5 with debugging or Ctrl + F5 with no debugging. This opens a browser and displays the following output.

Here, output "Hello World!" The configuration method from the Startup class, which exists in the Startup.cs file to open the Startup.cs file.

Then modify "Hello World!" If the string is something else, rerun the application and it will change the output accordingly.

ASP.NET Core Application template

As shown in the following figure, when creating ASP.NET Core Web, we have different types of project templates for creating ASP.NET Web applications.

Let's discuss all of these project templates.

Vbl.

As the name suggests, by default, the empty project template has nothing. If you want to perform all operations manually from scratch, you need to select empty template. The following figure shows the structure of an empty template.

API

The API template contains an example of creating a RESTful HTTP service.

As you can see from the image above, it contains only the controller folder. Site-specific things, such as CSS files, JavaScript files, view files, layout files, etc., do not exist.

This is because API does not have any user interface, so it does not contain such site-specific files. This API template also does not have the Model and views folder because they are not required for API.

Web Application template

The Web application template uses the new Razor page framework to build Web applications. With the new Razor page, the coding page-centric solution is simpler and more efficient.

We need to use this ASP.NET when we want to develop Web applications but do not want MVC to be completely complex. The following figure shows the structure of the Web application template.

Web Application (Model View-Controller) template

The Web application (model-view-controller) template contains what you need to create an ASP.NET CORE MVC Web application.

The Web application (Model-View-Controller) template creates model, view, and controller folders.

It also adds Web-specific content, such as JavaScript, CSS files, layout files, and so on, which are necessary and necessary for developing Web applications.

The following figure shows the structure of the Web application (Model-View-Controller) template.

Angular, React.js, React.js, and Redux:

Create an asp.net Web application that contains Angular, React.js, React.js, and and Redux, respectively.

Read here, this "how to create ASP.NET Core Web applications" article has been introduced, want to master the knowledge of this article also need to practice and use to understand, if you want to know more about the article, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report