ASP NET CORE INTRODUCTION

NET CORE

Today knowing how to build a web application is a good skill to have, because the web is the platform on which companies base or evolve their Business. Using ASP.NET Core to build web applications is a good choice because it allows you to build secure applications according to regulations. In this course we will learn this by dropping into a real project, building a real application.

WHY ASP NET CORE

It is important to stand critically before a new technology. What problems does it solve? Is it suitable for my case? and so on. Let’s try to understand what ASP.NET Core does, very broadly. First of all, it is a framework for the Web, which allows applications to be built faster and more securely. Two types of applications can be built, the first Web App is used to build applications that provide information dynamically, produce HTML by drawing data from a database or external services such as web services. The main users of a Web App are people; therefore, a person via http protocol connects to the application, reads information and enters their own. The second type of application is the Web Api whose users are other applications its purpose is to provide data for other applications to read and enter their own.

Applicazioni
Perche asp.net core

The application is modular; it will be the programmer who chooses the components to be installed, which benefits performance.

Stack Tecnologico

INSTALL .NET CORE SDK

The figure shows the link and path where the SDK is installed on the various platforms.

path

RUN THE FIRST .NET CORE APPLICATION

For this course I will use Rider as the code editor. You can use Rider or a free editor such as Visual Studio Code. Create a folder in your File System and call it MyCourse. Place in the path of the folder you created. Open the built-in terminal and type dotnet –version.

Structure

My version is 8.0.100, the latest available at the time I am writing this article. Go to the folder you just created and type dotnet new mvc to create the web application structure. Then type dotnet run and navigate your browser to http://localhost:5097 to see the welcome page.

SECTION SUMMARY

ASP.NET Core is a new framework built by Microsoft to build modern web applications and harness the full potential of the Internet to deliver our digital services and products.

The special features of ASP.NET Core are:

  • It is completely free and open-source;
  • It is a new framework but is built on Microsoft’s 20 years of experience and enriched through community feedback and input;
  • It easily allows you to write applications that comply with European regulations, such as GDPR and cookie regulations;
  • It is cloud-ready, meaning it is built to make it easy to transition from an on-premise server (located in the enterprise) to a cloud service, which can provide better scalability and availability;
  • Its modularity makes it an extremely lean and performant framework. We, as the developers, are the ones who decide in a timely manner how to compose our application, so as to achieve a sound compromise between performance and functionality;
  • It uses tricks that allow us to build secure applications by default;
  • Being cross-platform, we can program an ASP.NET Core application from Linux, macOS or Linux by taking advantage of an editor such as Visual Studio Code.

TYPES OF APPLICATIONS IN .NET CORE

What can we do with ASP.NET Core?

ASP.NET Core mainly enables two types of web applications:

  • Web UI: i.e., reference and/or data management Web sites that will be accessible from a browser. These include web apps that are highly interactive and built with JavaScript frameworks such as Angular and Vue.js. In this case the users are PEOPLE;
  • Web APIs: i.e., REST web services that facilitate integration with other external systems or are accessed by mobile apps, developed by us or third parties. In this case the users are other APPLICATIONS.

TO GET STARTED.

To start building a new application, we need to download .NET Core SDK which we get from the following address: https://www.microsoft.com/net/download

.NET Core SDK is available for all major platforms, for x86, x86-64 ARM32 and ARM64 architectures. By writing an application once, we can run it without modification on all supported platforms. We can use it to build console, IoT, and of course web applications with ASP.NET Core.

With .NET Core SDK are provided:

  • The .NET Core Runtime that includes all the components needed to run applications, the base objects and types, the gargabe collector, the JIT compiler, and the specific bindings that allow it to talk at a low level with the platform where it is installed;
  • Project creation and management tools, all accessible from a single dotnet command.

.NET Core is also available in the Runtime edition, which lacks the creation and management tools and is designed to be installed on the server where the application will be made available to all our users.

Various versions of .NET Core SDK can be installed without any problem. The various versions will coexist within the system, and at any time we can choose to use any of the installed versions.

ASP.NET Core is programmed in C#, which is the language that enjoys full support. VB.NET and F# are also supported, but in a fairly limited way.

CREATE AND RUN THE FIRST APPLICATION

The dotnet command is the entry point to all project management features. To create a new application, we open the command prompt (also called ‘terminal’ on Linux and macOS), create an empty directory, place in it, and finally execute:

dotnet new mvc

This will create a new application from a minimal template. To start the application we execute:

dotnet run

Congratulations! Did you see how easy it was to start the first application?