Create Your First Application With ASP.NET Core 3.1

In this article, we will create our first ASP.NET Core application with the Visual Studio 2019 and .NET Core 3.1 versions. This article is part of the ASP.NET Core series that I am going to start. In this series of articles, I will try to cover the basics as well as create a demo application for learning purposes.

What is ASP.NET Core?

ASP.NET Core is a framework for building modern web applications and services. It is part of .NET Core which is a cross-platform as well as an open-source framework. We said cross platforms means, we can develop and deploy the web application targeting several operating systems including Windows, Linux as well as macOS. Another feature that makes it popular is mentioned below

  1. Cross-platform as well as Open Source.
  2. Built-in support for the dependency injection (DI).
  3. It also includes a built-in Web server i.e. Kestral. You can run your application directly with the Kestral or can host your application under IIS, Ngnix, Apache, etc.
  4. Unified programming model for building the web as well as Web API (with the use of Controller as the base class).
  5. Lightweight and high-performance modular request pipeline which is suitable for the modern cloud-based application.

For creating our first ASP.NET Core application, I am using Visual Studio 2019 with .NET core 3.1 Version.

Let’s Begin

Open Visual Studio 2019 and click on Create a new project

Visual studio

On the next screen, select ASP.NET Core Web Application and click on the Next button

Create a new project

Configure your project name and the location where you want to create the application. Click on the Create button.

Configure your new project

As It’s our first application, we are trying to make it as simple as possible. Select .Net Core and ASP.NET Core 3.1 Version (as I am going to use the same version in upcoming tutorials of this series). Select the Empty template (We can create ASP.NET Core API, ASP.NET Core Application with Razor Pages, ASP.NET Core MVC, etc. application with the ASP.NET .NET Core). Unselect the configure for HTTPS checkbox as we are trying to make it as simple as possible and SSL is not required for that. Click on the Create button.

Create a new ASP  dot NET Core web application

Once the application is created you will see a screen like below.

ASP dot NET core

Go to the top navigation controls and run the Application on IIS Express as shown in the below image.

IIS Express

On clicking on IIS Express, You will see that the application is launched in the browser with the text Hello World on the screen.

Hello world

Now you might be confused about where this “Hello World” text is coming from. To understand that let’s open the startup.cs file from Solution Explorer. I have highlighted the line in the Configure method (Configure method is called during the runtime and used to configure the HTTP request pipeline. We will see more in detail about it when we cover Middleware use in ASP.NET Core web application)

Startup

Let’s change that text to something that you want to see on screen. For demonstration, I am changing it to “Hello World from IT Tutorials with Example”.

Hello world from it tutorials with examples

Build and run the application as we did in the above steps. The text which we changed is shown on the web browser.

Hello world from it tutorials with examples

Great! We have created our First Hello World Application with ASP.NET Core. In the next article, we will understand the basic file structure of the project that we have created.

I hope you like it. Thanks.