web analytics

ASP.NET Core Introduction

Options

codeling 1602 - 6666
@2019-12-02 09:49:45

ASP.NET

Before talking about ASP.NET Core, we should know what ASP.NET is. ASP.NET is a web application framework developed by Microsoft to build web applications and services. It extends the .NET platform with tools and libraries specifically for building web apps.

These are some things that ASP.NET adds to the .NET platform:

  • Base framework for processing web requests
  • Web-page templating syntax, known as Razor, for building dynamic web pages using C#
  • Libraries for common web patterns, such as Model View Controller (MVC)
  • Authentication system that includes libraries, a database, and template pages for handling logins, including multi-factor authentication and external authentication with Google, Twitter, and more.
  • Editor extensions to provide syntax highlighting, code completion, and other functionality specifically for developing web pages

ASP.NET supports a number of programming models for building web applications and services:

  • ASP.NET Web Forms – An event-driven application model for building modular pages out of components, with UI events being processed server-side.
  • ASP.NET MVC – A MVC application model for building web pages using the model–view–controller design pattern.
  • ASP.NET Web Pages – A SPA (Single Page Application) application model for adding dynamic code and data access directly inside HTML markup.
  • ASP.NET Web API – An API application model for building Web APIs on top of the .NET Framework.
  • SignalR – A real-time communications framework for bi-directional communication between client and server.

 

ASP.NET Core

ASP.NET Core is the open-source version of ASP.NET, it is a cross-platform framework for building web applications and web APIs that runs on macOS, Linux, and Windows. ASP.NET Core was first released in 2016 and is a redesign of earlier Windows-only versions of ASP.NET 4.x, with architectural changes that result in a leaner, more modular framework. With ASP.NET Core, you can:

  • Build web apps and services, IoT apps, and mobile backends.
  • Use your favorite development tools on Windows, macOS, and Linux.
  • Deploy to the cloud or on-premises.
  • Run on .NET Core or .NET Framework.

The following diagram shows the relationship between ASP.NET Core, ASP.NET, .NET Core, and .NET Framework. ASP.NET Core runs on both .NET Framework and .NET Core, so it can run cross-platform. Conversely, ASP.NET runs on .NET Framework only, so is tied to the Windows OS.

ASP.NET Core provides the following benefits:

  • A unified story for building web UI and web APIs.
  • Architected for testability.
  • Razor Pages makes coding page-focused scenarios easier and more productive.
  • Blazor lets you use C# in the browser alongside JavaScript. Share server-side and client-side app logic all written with .NET.
  • Ability to develop and run on Windows, macOS, and Linux.
  • Open-source and community-focused.
  • Integration of modern, client-side frameworks and development workflows.
  • Support for hosting Remote Procedure Call (RPC) services using gRPC.
  • A cloud-ready, environment-based configuration system.
  • Built-in dependency injection.
  • A lightweight, high-performance, and modular HTTP request pipeline.
  • Ability to host on the following:
    • Kestrel
    • IIS
    • HTTP.sys
    • Nginx
    • Apache
    • Docker
  • Side-by-side versioning.
  • Tooling that simplifies modern web development.

ASP.NET Core provides the following components:

  • Entity Framework (EF) Core
  • Identity Core
  • MVC Core
  • Razor Core
  • SignalR
  • Blazor

@2019-12-02 10:07:46

ASP.NET Core Releases

Version Number Release Date End of Support Development Tool
1.0 2016-06-27 2019-06-27 Visual Studio 2015, 2017
1.1 2016-11-18 2019-06-27 Visual Studio 2015, 2017
2.0 2017-08-14 2018-10-01 Visual Studio 2017
2.1 Long-term support 2018-05-30 2021-08-21 Visual Studio 2017
2.2 2018-12-04   Visual Studio 2017 15.9 and 2019 16.0 preview 1
3.0 2019-09-23   Visual Studio 2017 and 2019

 

ASP.NET Core 2.x can target .NET Core or .NET Framework. ASP.NET Core apps targeting .NET Framework aren't cross-platform—they run on Windows only. Generally, ASP.NET Core 2.x is made up of .NET Standard libraries. Libraries written with .NET Standard 2.0 run on any .NET platform that implements .NET Standard 2.0.

ASP.NET Core 2.x is supported on .NET Framework versions that implement .NET Standard 2.0:

  • .NET Framework latest version is strongly recommended.
  • .NET Framework 4.6.1 and later.

However ASP.NET Core 3.0 and later will only run on .NET Core. dropping support of .NET Framework.

@2019-12-02 10:55:18

ASP.NET Web Forms allowed developers to rapidly create web applications using a graphical designer and a simple event model that mirrored desktop application building techniques. But over time, it became apparent that ASP.NET Web Forms suffered from many issues, especially when building larger applications. In particular, a lack of testability, a complex stateful model, and limited influence over the generated HTML (making client-side development difficult) led developers to evaluate other options.

For example, ASP.NET Web Forms use ViewState to maintain the states between the client and server, you can see a hidden input type in the source code of an ASPX web page:

The problem with ViewState is the size. For years .NET developers forced to transfer kilobytes of useless information, like states of 20 controls for every roundtrip.

@2020-11-14 09:47:33

What's the difference between ASP.NET Web Forms, and ASP.NET MVC and ASP.NET Web Pages?

All three are ASP.NET technologies for creating dynamic web applications:

  • ASP.NET Web Forms is based on a page object model and traditional window-type controls (buttons, lists, etc.). Web Forms uses an event-based model that's familiar to those who've worked with client-based (Windows forms) development.
  • ASP.NET MVC implements the model-view-controller pattern for ASP.NET. The emphasis is on "separation of concerns" (processing, data, and UI layers).
  • ASP.NET Web Pages focuses on adding dynamic (server-side) code and database access to HTML pages, and features simple and lightweight syntax.

In general, the choice of which framework to use depends on your background and experience with ASP.NET.

 

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com