Loading

ASP.NET Core Web API

Creating ASP.NET Core Web API Project in Visual Studio 2019. The Complete ASP.NET Core Web API Developer Course 2023 [Videos].

In this Video, I am going to discuss How to Create, Build, Run, and Test the ASP.NET Core Web API project in Visual Studio 2019. Please read our previous Video, where we discussed How to Create, Build, Run, and Test ASP.NET Core Web API project using .NET Core CLI and Visual Studio Code.

Creating ASP.NET Core Web API Project Using Visual Studio 2019

Now, we are going to create the ASP.NET Core Web API project using Visual Studio 2019. So, open Visual Studio 2019 and then click on the Create a new project option as shown in the below image.

Creating ASP.NET Core Web API Project Using Visual Studio 2019

Once you click on the Create a new project option, the following Create a new project window will open. Here, you can find two projects template for creating the ASP.NET Core Web API project. One is using C# language and the other one is using F# language. I am going to use C# as the programming language, so I select the project template which uses C# Language as shown in the below image.

ASP.NET Core Web API project

Once you click on the Next button, then the configure your new project window will open. Here, you need to specify the Project name (MyFirstWebAPIProject) and the location where you want to create the project. And finally, click on the Next button as shown in the below image.

configure your new project

Once you click on the Next button, it will open the Additional Information window. Here, you need to select the Target .NET Framework version. The authentication Types. Whether you want to configure HTTPS and enable Docker. Select .NET 5, select authentication type as None, check the Configure for HTTPS and uncheck the Enable Docker checkboxes and then click on the Create button as shown in the below image.

Configuring ASP.NET Core Web API project in Visual Studio 2019

Once you click on the Create button, it will create the ASP.NET Core Web API project with the following file and folder structure. In our next Video, we will discuss all these files and folders in detail.

How to Create, Build, Run, and Test the ASP.NET Core Web API project in Visual Studio 2019

How to Build the ASP.NET Core Web API project in Visual Studio 2019?

We can build the ASP.NET Core Web API Project in many ways. So, let us discuss them. From the menus, select Build => Build Solution as shown in the below image.

How to Build the ASP.NET Core Web API project in Visual Studio 2019?

Once you select Build => Build Solution, then it will build all the projects that are there in the solution. Once the build is successful, you will get the below message in the output.

How to Build the ASP.NET Core Web API project in Visual Studio 2019?

You can also build your project by right-clicking on your project and then selecting the build option from the context menus as shown in the below images.

How to Build the ASP.NET Core Web API project in Visual Studio 2019?

You can also right-click on your solution and select the Build Solution option to build all your projects as shown in the below image.

How to Build the ASP.NET Core Web API project in Visual Studio 2019?

Note: If you use the Build Solution option, then it will build all your projects that are present inside the solution. If you want to build a particular project, then simply right-click on the Project and select the Build option which will build that project only. The last option to build projects in Visual Studio is a Keyboard shortcut. You can use Ctrl+Shift+B to build your solution.

How to run the ASP.NET Core Web API Application in Visual Studio 2019?

To run the application, simply click on the IIS Express green button as shown in the below image.

How to run the ASP.NET Core Web API Application in Visual Studio 2019?

Once you click on the IIS Express button, it will run the application and you will get the following swagger page in the browser. Please have a look at the Port number (44395) on which the application is running.

How to run the ASP.NET Core Web API Application in Visual Studio 2019

Here, the above swagger opens in the default Microsoft Edge browser. If you want then you can also change the default browser to something else like Google Chrome. To do so, simply click on the dropdown button which is appeared next to the IIS Express button as shown in the below image.

How to run the ASP.NET Core Web API Application in Visual Studio 2019?

Then select Google Chrome as the Web Browser as shown in the below image.

How to run the ASP.NET Core Web API Application in Visual Studio 2019?

With the above changes in place, now run the application and you must the web browser as Google Chrome.

Now, have look at the port number on which the application is running. My application is running on port number 44395. Now you test the API using the same approach that we have discussed in our previous two Videos. So, I am not going to discuss the same here. You just try yourself and if you face any problem, then let us know by putting a comment in the comment box. To simplify, I am just hitting the URL (https://localhost:44395/WeatherForecast) from my web browser and I am getting the result as expected as shown in the below image.

How to Test ASP.NET Core Web API

In the next Video, I am going to discuss the Default Files and Folders of the ASP.NET Core Web API Project. Here, in this Video, I try to explain How to Create, Build, Run, and Test ASP.NET Core Web API Application in Visual Studio 2019. I hope you enjoy this How to Create, Build, Run, and Test ASP.NET Core Web API in Visual Studio 2019 Video.

See All

Comments (609 Comments)

Submit Your Comment

See All Posts

Related Posts

ASP.NET Core Web API / Blog

Environment Setup for ASP.NET Core Web API Development

In this article, I am going to discuss the Environment Setup required for developing ASP.NET Core Web API Applications. Please read our previous article where we discussed HTTP Protocols. Tools and Software Requires for the development of ASP.NET Core Web API Applications.
8-Mar-2022 /43 /609

ASP.NET Core Web API / Blog

Creating ASP.NET Core Web API Project in Visual Studio 2019

In this article, I am going to discuss How to Create, Build, Run, and Test the ASP.NET Core Web API project in Visual Studio 2019. Please read our previous article, where we discussed How to Create, Build, Run, and Test ASP.NET Core Web API project using .NET Core CLI and Visual Studio Code.
8-Mar-2022 /43 /609

ASP.NET Core Web API / Blog

ASP.NET Core Web API Files and Folders

In this article, I am going to discuss the Files and Folders which are created by default when we create a new ASP.NET Core Web API Application. Please read our previous article where we discussed How to Create, Build, and Run ASP.NET Core Web API in Visual Studio 2019.
8-Mar-2022 /43 /609