0% found this document useful (0 votes)
40 views25 pages

CH 1

Uploaded by

kbeydoun1980
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views25 pages

CH 1

Uploaded by

kbeydoun1980
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

ASP.

Net Core – Getting


Started
Kamal Beydoun
Lebanese University – Faculty of Sciences I
[email protected]
Introduction
ASP.NET Core is the latest evolution of Microsoft’s popular ASP.NET
web framework
 released in June 2016.
 focusing on high developer productivity and prioritizing backwards compatibility.
ASP.NET Core bucks that trend by making significant architectural
changes that rethink the way the web framework is designed and built.

2
Introduction
 ASP.NET Core makes writing web applications faster, easier, and more secure.
 It contains libraries for common things like:
 Creating dynamically changing web pages
 Letting users log in to your web app
 Letting users use their Facebook account to log in to your web app using OAuth
 Providing a common structure to build maintainable applications
 Reading configuration files
The key to any modern web application is the ability to generate dynamic web pages.
3
Introduction
 The Stack Overflow website (http://stackoverflow.com) is built using
ASP.NET and is almost entirely dynamic content.

4
ASP.NET Framework
ASP.NET Web Forms
 create web applications using a graphical designer and a simple event model. 
 lack of testability, a complex stateful model (making client-side development
difficult). 
Microsoft released the first version of ASP.NET MVC in 2009, based on
the Model-View-Controller pattern.

5
What is ASP.NET Core?
Is a lightweight platform that runs on Windows, Linux, and macOS.
Shares many of the same APIs as .NET Framework, but it’s smaller.
Provides a simpler implementation and programming model.
It’s a completely new platform, rather than a fork of .NET Framework,
though it uses similar code for many of its APIs.

6
What is ASP.NET Core?

7
What is ASP.NET Core?

 Most of the libraries you’ll


use in ASP.NET Core can
be found on GitHub :
https://github.com/aspnet

8
What type of applications can you build?
 Server-side-rendered web applications are the bread and butter of ASP.NET
development.
 Single-Page Applications (SPAs), which use a client-side framework that
commonly talks to a REST server, are easy to create with ASP.NET Core.
 SPA is a web app that interacts with the user by dynamically rewriting the current page
rather than loading entire new pages from a server.
 Whether you’re using Angular, Ember, React, or some other client-side
framework, it’s easy to create an ASP.NET Core application to act as the
server-side API.
9
What type of applications can you build?

• It can serve HTML pages for traditional web


applications
• It can act as a REST API for client-side SPA
applications
• It can act as an ad-hoc RPC service for client
applications.

10
If you’re new to .NET development
ASP.NET Core has many selling points when compared to
other cross-platform web frameworks:
It’s a modern, high-performance, open source web framework.
It uses familiar design patterns and paradigms.
C# is a great language (or you can use VB.NET or F# if you
prefer).

11
If you’re new to .NET development
The primary language of .NET development, and ASP.NET
Core in particular, is C#.
It provides a sense of familiarity to those used to C, Java, and many
other languages.
It has many powerful features, such as Language Integrated Query
(LINQ) and asynchronous programming constructs.

12
Compile-once, Run-anywhere
As well as running on each platform, one of the selling points
of .NET is the ability to write and compile only once.
Your application is compiled to Intermediate Language (IL)
code, which is a platform-independent format.
If a target system has the .NET Core platform installed, then you
can run compiled IL from any platform.

13
Main ASP.NET Core benefits over ASP.Net
Framework
Cross-platform development and deployment
A focus on performance as a feature
Regular releases with a shorter release cycle
Open source
Modular features
A simplified hosting model

14
Hosting in ASP.NET and ASP.NET Core

IIS is tightly
coupled with the
application. To be competitive cross-
platform, the ASP.NET
team have focused on
making the Kestrel HTTP
IIS hands off the server as fast as possible.
request to a self-
hosted web server in
the ASP.NET Core
application
15
NuGet
The entire web framework is implemented as NuGet packages
NuGet is a package manager for .NET that enables importing
libraries into your projects.

16
How does ASP.NET work?

17
How does ASP.NET Core process a request?

Kestrel is responsible for


receiving raw requests and
constructing an internal
representation of the data, an
HttpContext object, which
can be used by the rest of the
application.

18
.Net Framework vs .Net Core
 .NET Core : The cross-platform and container-friendly.
 Your app relies on many Windows-only features, then .NET Framework may be the easiest
option.
 .NET Framework is that it has the greatest library support, in the form of NuGet packages.
 The open source nature of .NET Core development can be a big deciding factor for some people.
 The highly modular design of .NET Core, it’s likely that the platform will see a faster release
cycle than other platforms.
 .NET Core also follows semantic versioning (SemVer), so you can be sure that your old
applications won’t be affected by installing a new version of the framework.

19
Preparing your development environment
All of ASP.NET Core (creating new projects, building, testing,
and publishing) can be run from the command line for any
supported operating system.
All you need is the .NET Core SDK and tooling, which provides
the .NET Command Line Interface (CLI).

20
Visual Studio 2022

Visual Studio is a full-featured


integrated development
environment (IDE), which
provides one of the best all-around
experiences for developing
ASP.NET Core applications.

21
.Net SDK and tooling
Whether you install Visual Studio or another editor, such as Visual Studio
Code, you’ll need to install the .NET Core tooling to start building
ASP.NET Core apps.
 In this course, slides are prepared for .NET Core 5.
 .NET 7 is available and could also be used. Main differences will be explained.
You can either download it from the ASP.NET website (https://get.asp.net)
or select the .NET Core cross-platform development workload during
Visual Studio 2022 installation.
22
Summary
ASP.NET Core is a new web framework built with modern software
architecture practices and modularization as its focus.
It’s best used for new, “green-field” projects with few external
dependencies.
Existing technologies such as WCF and SignalR can’t currently be used
with ASP.NET Core, but work is underway to integrate them.
Fetching a web page involves sending an HTTP request and receiving an
HTTP response.
23
Summary
 ASP.NET Core allows dynamically building responses to a given request.
 An ASP.NET Core application contains a web server, which serves as the entrypoint for a request.
 ASP.NET Core apps are protected from the internet by a reverse-proxy server, which forwards requests to
the application.
 ASP.NET Core can run on both .NET Framework and .NET Core. If you need Windows-specific features
such as the Windows Registry, you should use .NET Framework, but you won’t be able to run cross-
platform. Otherwise, choose .NET Core for the greatest reach and hosting options.
 The OmniSharp project provides C# editing plugins for many popular editors, including the cross-
platform Visual Studio Code editor.
 On Windows, Visual Studio provides the most complete all-in-one ASP.NET Core development
experience, but development using the command line and an editor is as easy as on other platforms.
24
Extra

25

You might also like