ASP.NET Core Middleware Fundamentals

Slides:



Advertisements
Similar presentations
1 SDMX Reference Infrastructure (SDMX-RI) Work in progress, status and plans Bengt-Åke Lindblad, Adam Wroński Eurostat Eurostat Unit B3 – IT and standards.
Advertisements

Kit Chan ATS Lua Plugin Kit Chan Hi, My name is kit.
INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.
Chris J.T. Auld Director – Strategy and Innovation Intergen MSDN Regional Director.
Satisfy Your Technical Curiosity Internet Information Services (IIS) 7.0 End-to-End Overview of Microsoft's New Web Application Server Bart De Smet MVP,
Internet Information Server (IIS)
Virtual techdays INDIA │ November 2010 ASP.Net MVC Deep Dive Sundararajan S │ Associate Tech Architect, Aditi Technologies.
Windows Server 2008 Chapter 8 Last Update
April-June 2006 Windows Hosting Seminar Series Product Roadmap: IIS 7.0 Matthew Boettcher Web Platform Technical Evangelist (Hosting) Developer & Platform.
Enterprise Resource Planning
Client/Server Architectures
.NET, and Service Gateways Group members: Andre Tran, Priyanka Gangishetty, Irena Mao, Wileen Chiu.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Implementing ISA Server Publishing. Introduction What Are Web Publishing Rules? ISA Server uses Web publishing rules to make Web sites on protected networks.
DEV402 Extending the ASP.NET Runtime Jurgen Postelmans Microsoft Regional Director BeLux U2U.
Composer packages Installing and Using Composer, Packagist, Packaging your code Mario Peshev Technical Trainer Software University
Grid Chemistry System Architecture Overview Akylbek Zhumabayev.
The.NET Runtime and IIS Presented by Chris Dickey – cdickey.net consulting
Hands-On Microsoft Windows Server Implementing Microsoft Internet Information Services Microsoft Internet Information Services (IIS) –Software included.
Dean Anderson Polk County, Oregon GIS in Action 2014 Modifying Open Source Software (A Case Study)
CIS 375—Web App Dev II ASP.NET 1 Getting Started.
.NET Mobile Application Development XML Web Services.
BZUPAGES.COM WEB SERVER PRESENTED TO: SIR AHMAD KAREEM.
Free, online, technical courses Take a free online course. Microsoft Virtual Academy.
By: Ahmed Marzouk OWIN & KATANA. Agenda A Brief History What is OWIN and Why? What is KATANA? OWIN Specifications OWIN/KATANA Goals.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
Presented by Michael Rainey South Mississippi Linux Users Group
ArcGIS for Server Security: Advanced
Windows Communication Foundation and Web Services
Jim Fawcett CSE681 – SW Modeling & Analysis Spring 2005
DevOps with ASP.NET Core and Entity Framework Core
Module 6 Practical part: Creation of X-Road dataservice and client based on WSDL (.NET platform) Name Date.
WebSphere Diego Leone.
Introduction to .NET Florin Olariu
Apache Web Server v. 2.2 Reference Manual
Microsoft Connect /28/ :21 AM
Node.js Express Web Applications
Ad-blocker circumvention System
DotNetNuke® Web Application Framework
Self Healing and Dynamic Construction Framework:
Migrating SharePoint Add-ins from Azure ACS to Azure AD
ASP.NET Core 2.0 Fundamentals
Node.js Express Web Services
ASP.NET Web Forms and Web Services
Security mechanisms and vulnerabilities in .NET
Processes The most important processes used in Web-based systems and their internal organization.
Lean .NET stack for building modern web apps
Explore web development with Microsoft ASP.NET Core 1.0
Dive deep into ASP.NET Core 1.0
Explore web development with Microsoft ASP.NET Core 1.0
Present by Andie Saizan, MCP
Should I Transition to .NET Core? Will it hurt?
The Model Layer What is Model?
ASP.NET Module Subtitle.
IIS v7.0 Martin Parry Developer & Platform Group Microsoft Limited
Saranya Sriram Developer Evangelist | Microsoft
Student: Popa Andrei-Sebastian
Image Gallery With SignalR
Azure Active Directory
WinINet Kostas Ladavičius.
#01# ASP.NET Core Overview Design by: TEDU Trainer: Bach Ngoc Toan
IIS and .NET Security Application Pools Pamella Smith June 18, 2009.
Development Environment Setup
Dependency Injection Mechanism
Concepts in ASP.NET Core App
Migrate ASP.NET Core 1.x to 2.0
Application Startup in ASP.NET Core
Building Your First ASP.NET Core Web Application
Migrate ASP.NET Core 1.x to 2.0
Presentation transcript:

ASP.NET Core Middleware Fundamentals #05# ASP.NET Core Middleware Fundamentals Design by: TEDU Trainer: Bach Ngoc Toan Website: www.tedu.com.vn Facebook: fb.com/teduchannel Please like videos and subscribe TEDU Channel to following the next video.

What is middleware Middleware is software that is assembled into an application pipeline to handle requests and responses. This means that they are effectively "gateway" classes that can decide whether or not to continue allowing the request to be processed by other Middleware components further down the stream.

Processing HTTP Requests

Processing HTTP Requests

Processing HTTP Requests

Configuring Middleware Adding middleware to an application happens in the Configure method of the startup class for an application. The Configure method is injectable, meaning you can ask for any other services you need, but the one service you’ll always need is the IApplicationBuilder service. Most middleware will live in a NuGet package. Each NuGet package will include extension methods for IApplicationBuilder to add a middleware component using a simple method call. Notice the extension methods all start with the word Use.

Configuring Middleware The order that middleware components are added in the Configure method defines the order in which they are invoked on requests, and the reverse order for the response.

Built-in middleware Middleware Description Authentication Provides authentication support. CORS Configures Cross-Origin Resource Sharing. Response Caching Provides support for caching responses. Response Compression Provides support for compressing responses. Routing Defines and constrains request routes. Session Provides support for managing user sessions. Static Files Provides support for serving static files and directory browsing. URL Rewriting Middleware Provides support for rewriting URLs and redirecting requests.

Creating Middleware First, Invoke will receive an HttpContext object with access to the request and the response. You can inspect incoming headers and create outgoing headers. You can read the request body or write into the response. The logic inside Invoke can decide if you want to call the next piece of middleware or handle the response entirely in the current middleware. Note the name Invoke is the method ASP.NET will automatically look for (no interface implementation required), and is injectable.

Run, Map, and Use Run is a convention, and some middleware components may expose Run[Middleware] methods that run at the end of the pipeline.  Map branches the request pipeline based on matches of the given request path MapWhen branches the request pipeline based on the result of the given predicate.

Migrating module code to middleware IHttpModule  Middleware IHttpHandler  Middleware

Advantages The ability to explicitly configure every component of the HTTP processing pipeline makes it easy to know what is happening inside an application. The application is also as lean as possible because we can install only the features an application requires. Middleware is one reason why ASP.NET Core can perform better and use less memory than its predecessors.

Disadvantages Time consuming to move existed HTTP modules to middleware when migrate from older version to .NET Core. Middleware components are highly asynchronous and often follow functional programming idioms. Also, there are no interfaces to guide middleware development  as most of the contracts rely on convention instead of the compiler. All of these changes make some developers uncomfortable. Difficulty when find match middleware in Nuget before make decision to create new middleware.

Summary Expect to see middleware play an increasingly important role in the future.  Not only will Microsoft and others create more middleware, but also expect the sophistication of middleware to increase. Future middleware will not only continue to replace IIS features like URL re- writing, but also change our application architecture by enabling additional frameworks and the ability to compose new behavior into an application. Don’t underestimate the importance of porting existing logic into middleware and the impact of a middleware on an application’s behavior.