SlideShare a Scribd company logo
What’s new in ASP.NET Core 6
Tamir Dresher, System Architect @ Payoneer
@tamir_dresher
ASP.NET Core Stack
Worker
Services
Services
SignalR gRPC
Web UI
MVC
HTTP
APIs
Razor
Pages
Blazor
SPA
Hosting
Servers
Kestrel IIS HTTP.sys
Middleware
Routing Security Localization Caching
Compression Session Health Checks …
Extensions
Logging
Dependency
Injection
Configuration
Options
File Providers
System Architect @ @tamir_dresher
Tamir Dresher
My Books:
Software Engineering Lecturer
Ruppin Academic Center https://www.israelclouds.com/iasaisrael
https://tinyurl.com/Telescopim-YouTube
What’s new
Simplicity & Productivity
• New hosting model
• Minimal APIs
• Hot reload
• Async Streaming
Performance
• .NET 6
• Network processing
• Hosting overhead
Better JS FXs Integration
• Frameworks versions
• Webpack dev server proxy
support
Blazor
• Middleware request throughput is ~5% faster in .NET 6.
• MVC on Linux is ~12%, thanks to faster logging.
• Minimal APIs = MVC*2
• HTTPS connections use ~40% less memory, thanks to zero
byte reads.
• Protobuf serialization is ~20% faster with .NET 6.
Simplicity & Productivity
• New hosting model
• Minimal APIs
• Hot reload
• Async Streaming
Performance
• .NET 6
• Network processing
• Hosting overhead
Better JS FXs Integration
• Frameworks versions
• Webpack dev sever proxy support
Blazor
Blazor
• .NET Hot reload
• State persistence during prerendering
• Error boundaries
• WebAssembly AOT
• Runtime relinking
• Native dependencies
• Smaller download size
• Render components from JS
• Custom event args
• JavaScript initializers
• JavaScript modules per component
• Infer generic types from parent
• Generic type constraints
• Handle large binary data
• Remove SignalR message size limitations
• Required parameters
• Handle query string parameters
• Influence the HTML head
• SVG support
New hosting model
ASP.NET Core 5 Hosting model
Progra
m
Host
• WebServer
Integration
• HTTP Server
• App settings
• Core configurations
Startup
• ConfigureServices() – DI,
Middelwares pipeline
definition
• Configure() – Pipeline
“compilation”, Endpoints
setup
Main()
create
create
ConfigureServices()
Configure()
WebApplication vs IHost
• Introducing a lower ceremony replacement for the WebHost to remove
some of the ceremony in hosting ASP.NET Core applications
IHost? host = CreateHostBuilder(args).Build();
static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
...
}); var builder = WebApplication.CreateBuilder(args);
...
WebApplication? app = builder.Build();
WebApplication
• Reduce the number of callbacks used to configure top level things
• Expose top level properties for things people commonly resolve in Startup.Configure.
• This allows them to avoid using the service locator pattern for IConfiguration, ILogger, IHostApplicationLifetime.
• Merge the IApplicationBuilder, the IEndpointRouteBuilder and the IHost into a single object.
• This makes it easy to register middleware and routes without needed an additional level of lambda nesting
• Merge the IConfigurationBuilder, IConfiguration, and IConfigurationRoot into a single
Configuration type so that we can access configuration while it's being built.
• This is important since you often need configuration data as part of configuring services.
• UseRouting and UseEndpoints are called automatically (if they haven't already been called) at
the beginning and end of the pipeline.
"Minimal hosting" for ASP.NET Core applications · Issue #30354 · dotnet/aspnetcore (github.c
WebApplication
namespace Microsoft.AspNetCore.Builder
{
//
// Summary:
// The web application used to configure the HTTP pipeline, and routes.
public sealed class WebApplication : IHost, IDisposable,
IApplicationBuilder,
IEndpointRouteBuilder,
IAsyncDisposable
{
...
}
}
From 5 to 6
• Migrate from ASP.NET Core 5.0 to 6.0 | Microsoft Docs
• .NET 6 ASP.NET Core Migration (github.com)
https://gist.github.com/davidfowl/0e0372c3c1d895c3ce195ba983b1e03d
Minimal APIs
Minimal APIs
from fastapi import FastAPI
import python_weather
app = FastAPI()
@app.get("/api/weather")
async def root():
weather = await python_weather.Client().getAllReports()
return weather
const express = require("express");
const app = express();
app.get("/api/weather ", (req, res) => {
res.send(getAllWeatherReports());
});
// Listen to the App Engine-specified port, or 8080
otherwise
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.log(`Server listening on port ${PORT}...`);
});
Minimal APIs
var app = WebApplication.CreateBuilder(args).Build();
app.MapGet("/weatherforecast", () =>
{
var forecasts = Enumerable.Range(1, 5).Select(index =>
...
.ToArray();
return forecasts;
})
984
820
425
0
200
400
600
800
1000
1200
Middleware Min API Controller
API performance (1k RPS)
Performance
• HTTP APIs – pay for play
• ~5% RPS gain for middleware in .NET 6
• New min API twice as fast as API controllers
• Faster JWT authentication
• ~40% faster gain in JWT middleware
• MVC on Linux
• ~12% faster thanks to faster logging
• More efficient MemoryCache
• ~10% RPS gain on cache TechEmpower benchmark
• Reduced memory usage per https connection
• ~70% working set reduction for idle WebSocket connections
• HTTP/2 & gRPC
• Improvements to HttpClient connection management
• ~20% faster Protobuf serialization
dotNETConf/Roth_ASP.NET_Core_MVC_Razor_Pages_in_.NET6.pptx at master · dotnet-presentations/dotNETConf (github.com)
Async Streams
IAsyncEnumerable, IAsyncEnumerator & IAsyncDisposable
IEnumerable
namespace System.Collections.Generic
{
public interface IEnumerable<out T> : IEnumerable
{
IEnumerator<T> GetEnumerator();
}
public interface IEnumerator<out T> : IDisposable,
IEnumerator
{
bool MoveNext ();
T Current { get; }
}
}
var fibNums = new List<int> { 0, 1, 1, 2, 3, 5, 8, 13 };
foreach (int element in fibNums)
{
Console.Write($"{element} ");
}
private IEnumerable<int> Fibonacci(int n)
{
int a = 0; int b = 1; int sum = 0;
for (int i = 0; i < n; i++)
{
yield return a;
sum = a + b;
a = b;
b = sum;
}
}
Iterators and Async
namespace System.Collections.Generic
{
public interface IEnumerable<out T> : IEnumerable
{
IEnumerator<T> GetEnumerator();
}
public interface IEnumerator<out T> : IDisposable,
IEnumerator
{
bool MoveNext ();
T Current { get; }
}
}
var fibNums = new List<int> { 0, 1, 1, 2, 3, 5, 8, 13 };
foreach (int element in fibNums)
{
Console.Write($"{element} ");
}
private async IEnumerable<int> Fibonacci(int n)
{
int a = 0; int b = 1; int sum = 0;
for (int i = 0; i < n; i++)
{
await SomeAsyncMethod();
yield return a;
sum = a + b;
a = b;
b = sum;
}
}
IAsyncEnumerable
namespace System.Collections.Generic
{
public interface IAsyncEnumerable<out T>
{
IAsyncEnumerator<T> GetAsyncEnumerator(
CancellationToken cancellationToken = default);
}
public interface IAsyncEnumerator<out T> : IAsyncDisposable
{
ValueTask<bool> MoveNextAsync();
T Current { get; }
}
}
namespace System
{
public interface IAsyncDisposable
{
ValueTask DisposeAsync();
}
}
namespace System.Collections.Generic
{
public interface IEnumerable<out T> : IEnumerable
{
IEnumerator<T> GetEnumerator();
}
public interface IEnumerator<out T> : IDisposable,
IEnumerator
{
bool MoveNext ();
T Current { get; }
}
}
Iterators and Async - IAsyncEnumerable
var fibNums = Fibonacci(20)
await foreach (int element in fibNums)
{
Console.Write($"{element} ");
}
private async IAsyncEnumerable<int> Fibonacci(int n)
{
int a = 0; int b = 1; int sum = 0;
for (int i = 0; i < n; i++)
{
await SomeAsyncMethod();
yield return a;
sum = a + b;
a = b;
b = sum;
}
}
namespace System.Collections.Generic
{
public interface IAsyncEnumerable<out T>
{
IAsyncEnumerator<T> GetAsyncEnumerator(
CancellationToken cancellationToken = default);
}
public interface IAsyncEnumerator<out T> :
IAsyncDisposable
{
ValueTask<bool> MoveNextAsync();
T Current { get; }
}
}
New SPA templates
SPA Dev Server ASP.NET Core Backend
Browser requests goes to
Dev Server URL
Requests forwarded backend
via the Dev Server proxy
Summary
Simplicity & Productivity
• New hosting model
• Minimal APIs
• Hot reload
• Async Streaming
Performance
• .NET 6
• Network processing
• Hosting overhead
Better JS FXs Integration
• Frameworks versions
• Webpack dev server proxy
support
Tamir Dresher - What’s new in ASP.NET Core 6

More Related Content

What's hot (20)

PDF
Ansible
Rahul Bajaj
 
PPTX
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
eZ Systems
 
PDF
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
CodeValue
 
PDF
Infrastructure as code
daisuke awaji
 
PPTX
Powershell For Developers
Ido Flatow
 
PDF
AWSインフラのコード化にトライしてみて
daisuke awaji
 
PPTX
Owin and katana
Udaiappa Ramachandran
 
PPTX
Angular Owin Katana TypeScript
Justin Wendlandt
 
PPT
CloudStack S3
Sebastien Goasguen
 
PPTX
Sherlock Homepage - A detective story about running large web services (VISUG...
Maarten Balliauw
 
PPTX
ASP.NET Core 1.0 Overview
Shahed Chowdhuri
 
PDF
Building a Serverless company with Node.js, React and the Serverless Framewor...
Luciano Mammino
 
PPTX
Flask & Flask-restx
ammaraslam18
 
PDF
Serverless Architecture - A Gentle Overview
CodeOps Technologies LLP
 
PDF
Serverless Containers
Nilesh Gule
 
PDF
Continuous delivery in AWS
Anton Babenko
 
PPTX
ASP.NET Core: The best of the new bits
Ken Cenerelli
 
PDF
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Arrow Consulting & Design
 
PPTX
Yii2 by Peter Jack Kambey
k4ndar
 
PPTX
"The F# Path to Relaxation", Don Syme
Fwdays
 
Ansible
Rahul Bajaj
 
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
eZ Systems
 
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
CodeValue
 
Infrastructure as code
daisuke awaji
 
Powershell For Developers
Ido Flatow
 
AWSインフラのコード化にトライしてみて
daisuke awaji
 
Owin and katana
Udaiappa Ramachandran
 
Angular Owin Katana TypeScript
Justin Wendlandt
 
CloudStack S3
Sebastien Goasguen
 
Sherlock Homepage - A detective story about running large web services (VISUG...
Maarten Balliauw
 
ASP.NET Core 1.0 Overview
Shahed Chowdhuri
 
Building a Serverless company with Node.js, React and the Serverless Framewor...
Luciano Mammino
 
Flask & Flask-restx
ammaraslam18
 
Serverless Architecture - A Gentle Overview
CodeOps Technologies LLP
 
Serverless Containers
Nilesh Gule
 
Continuous delivery in AWS
Anton Babenko
 
ASP.NET Core: The best of the new bits
Ken Cenerelli
 
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Arrow Consulting & Design
 
Yii2 by Peter Jack Kambey
k4ndar
 
"The F# Path to Relaxation", Don Syme
Fwdays
 

Similar to Tamir Dresher - What’s new in ASP.NET Core 6 (20)

PPT
Intoduction to Play Framework
Knoldus Inc.
 
PPTX
Intro to Node
Aaron Stannard
 
PDF
The use case of a scalable architecture
Toru Wonyoung Choi
 
PDF
Time for Functions
simontcousins
 
KEY
Writing robust Node.js applications
Tom Croucher
 
PDF
Introduction to the New Asynchronous API in the .NET Driver
MongoDB
 
PDF
Non Blocking I/O for Everyone with RxJava
Frank Lyaruu
 
PDF
Reimagine Frontend in the Serverless Era
Evangelia Mitsopoulou
 
PDF
Python, do you even async?
Saúl Ibarra Corretgé
 
PDF
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Masahiro Nagano
 
PPTX
El camino a las Cloud Native Apps - Introduction
Plain Concepts
 
PDF
Apache Samza 1.0 - What's New, What's Next
Prateek Maheshwari
 
PDF
Working with data using Azure Functions.pdf
Stephanie Locke
 
PPTX
History of asynchronous in .NET
Marcin Tyborowski
 
PPTX
Ektron CMS400 8.02
Alpesh Patel
 
PDF
Advanced iOS Build Mechanics, Sebastien Pouliot
Xamarin
 
PPTX
Scaling asp.net websites to millions of users
oazabir
 
PPTX
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
Rodolfo Finochietti
 
PPT
Mobile webapplication development
Ganesh Gembali
 
PDF
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Fwdays
 
Intoduction to Play Framework
Knoldus Inc.
 
Intro to Node
Aaron Stannard
 
The use case of a scalable architecture
Toru Wonyoung Choi
 
Time for Functions
simontcousins
 
Writing robust Node.js applications
Tom Croucher
 
Introduction to the New Asynchronous API in the .NET Driver
MongoDB
 
Non Blocking I/O for Everyone with RxJava
Frank Lyaruu
 
Reimagine Frontend in the Serverless Era
Evangelia Mitsopoulou
 
Python, do you even async?
Saúl Ibarra Corretgé
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Masahiro Nagano
 
El camino a las Cloud Native Apps - Introduction
Plain Concepts
 
Apache Samza 1.0 - What's New, What's Next
Prateek Maheshwari
 
Working with data using Azure Functions.pdf
Stephanie Locke
 
History of asynchronous in .NET
Marcin Tyborowski
 
Ektron CMS400 8.02
Alpesh Patel
 
Advanced iOS Build Mechanics, Sebastien Pouliot
Xamarin
 
Scaling asp.net websites to millions of users
oazabir
 
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
Rodolfo Finochietti
 
Mobile webapplication development
Ganesh Gembali
 
Maciej Treder "Server-side rendering with Angular—be faster and more SEO, CDN...
Fwdays
 
Ad

More from Tamir Dresher (20)

PPTX
Engineering tools for making smarter decisions .pptx
Tamir Dresher
 
PDF
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
Tamir Dresher
 
PPTX
Tamir Dresher - DotNet 7 What's new.pptx
Tamir Dresher
 
PPTX
Anatomy of a data driven architecture - Tamir Dresher
Tamir Dresher
 
PPTX
Tamir Dresher Clarizen adventures with the wild GC during the holiday season
Tamir Dresher
 
PDF
Debugging tricks you wish you knew Tamir Dresher - Odessa 2019
Tamir Dresher
 
PDF
From zero to hero with the actor model - Tamir Dresher - Odessa 2019
Tamir Dresher
 
PPTX
Tamir Dresher - Demystifying the Core of .NET Core
Tamir Dresher
 
PPTX
Breaking the monolith to microservice with Docker and Kubernetes (k8s)
Tamir Dresher
 
PPTX
.Net december 2017 updates - Tamir Dresher
Tamir Dresher
 
PPTX
Testing time and concurrency Rx
Tamir Dresher
 
PPTX
Building responsive application with Rx - confoo - tamir dresher
Tamir Dresher
 
PPTX
.NET Debugging tricks you wish you knew tamir dresher
Tamir Dresher
 
PPTX
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
PPTX
Building responsive applications with Rx - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
PPTX
Debugging tricks you wish you knew - Tamir Dresher
Tamir Dresher
 
PPTX
Rx 101 - Tamir Dresher - Copenhagen .NET User Group
Tamir Dresher
 
PPTX
Cloud patterns - NDC Oslo 2016 - Tamir Dresher
Tamir Dresher
 
PPTX
Reactiveness All The Way - SW Architecture 2015 Conference
Tamir Dresher
 
PPTX
Rx 101 Codemotion Milan 2015 - Tamir Dresher
Tamir Dresher
 
Engineering tools for making smarter decisions .pptx
Tamir Dresher
 
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
Tamir Dresher
 
Tamir Dresher - DotNet 7 What's new.pptx
Tamir Dresher
 
Anatomy of a data driven architecture - Tamir Dresher
Tamir Dresher
 
Tamir Dresher Clarizen adventures with the wild GC during the holiday season
Tamir Dresher
 
Debugging tricks you wish you knew Tamir Dresher - Odessa 2019
Tamir Dresher
 
From zero to hero with the actor model - Tamir Dresher - Odessa 2019
Tamir Dresher
 
Tamir Dresher - Demystifying the Core of .NET Core
Tamir Dresher
 
Breaking the monolith to microservice with Docker and Kubernetes (k8s)
Tamir Dresher
 
.Net december 2017 updates - Tamir Dresher
Tamir Dresher
 
Testing time and concurrency Rx
Tamir Dresher
 
Building responsive application with Rx - confoo - tamir dresher
Tamir Dresher
 
.NET Debugging tricks you wish you knew tamir dresher
Tamir Dresher
 
From Zero to the Actor Model (With Akka.Net) - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
Building responsive applications with Rx - CodeMash2017 - Tamir Dresher
Tamir Dresher
 
Debugging tricks you wish you knew - Tamir Dresher
Tamir Dresher
 
Rx 101 - Tamir Dresher - Copenhagen .NET User Group
Tamir Dresher
 
Cloud patterns - NDC Oslo 2016 - Tamir Dresher
Tamir Dresher
 
Reactiveness All The Way - SW Architecture 2015 Conference
Tamir Dresher
 
Rx 101 Codemotion Milan 2015 - Tamir Dresher
Tamir Dresher
 
Ad

Recently uploaded (20)

PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
IObit Driver Booster Pro 12.4.0.585 Crack Free Download
henryc1122g
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Adobe Premiere Pro Crack / Full Version / Free Download
hashhshs786
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
Add Background Images to Charts in IBM SPSS Statistics Version 31.pdf
Version 1 Analytics
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
IObit Driver Booster Pro 12.4.0.585 Crack Free Download
henryc1122g
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Adobe Premiere Pro Crack / Full Version / Free Download
hashhshs786
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Add Background Images to Charts in IBM SPSS Statistics Version 31.pdf
Version 1 Analytics
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 

Tamir Dresher - What’s new in ASP.NET Core 6

  • 1. What’s new in ASP.NET Core 6 Tamir Dresher, System Architect @ Payoneer @tamir_dresher
  • 2. ASP.NET Core Stack Worker Services Services SignalR gRPC Web UI MVC HTTP APIs Razor Pages Blazor SPA Hosting Servers Kestrel IIS HTTP.sys Middleware Routing Security Localization Caching Compression Session Health Checks … Extensions Logging Dependency Injection Configuration Options File Providers
  • 3. System Architect @ @tamir_dresher Tamir Dresher My Books: Software Engineering Lecturer Ruppin Academic Center https://www.israelclouds.com/iasaisrael https://tinyurl.com/Telescopim-YouTube
  • 4. What’s new Simplicity & Productivity • New hosting model • Minimal APIs • Hot reload • Async Streaming Performance • .NET 6 • Network processing • Hosting overhead Better JS FXs Integration • Frameworks versions • Webpack dev server proxy support Blazor • Middleware request throughput is ~5% faster in .NET 6. • MVC on Linux is ~12%, thanks to faster logging. • Minimal APIs = MVC*2 • HTTPS connections use ~40% less memory, thanks to zero byte reads. • Protobuf serialization is ~20% faster with .NET 6.
  • 5. Simplicity & Productivity • New hosting model • Minimal APIs • Hot reload • Async Streaming Performance • .NET 6 • Network processing • Hosting overhead Better JS FXs Integration • Frameworks versions • Webpack dev sever proxy support Blazor Blazor • .NET Hot reload • State persistence during prerendering • Error boundaries • WebAssembly AOT • Runtime relinking • Native dependencies • Smaller download size • Render components from JS • Custom event args • JavaScript initializers • JavaScript modules per component • Infer generic types from parent • Generic type constraints • Handle large binary data • Remove SignalR message size limitations • Required parameters • Handle query string parameters • Influence the HTML head • SVG support
  • 7. ASP.NET Core 5 Hosting model Progra m Host • WebServer Integration • HTTP Server • App settings • Core configurations Startup • ConfigureServices() – DI, Middelwares pipeline definition • Configure() – Pipeline “compilation”, Endpoints setup Main() create create ConfigureServices() Configure()
  • 8. WebApplication vs IHost • Introducing a lower ceremony replacement for the WebHost to remove some of the ceremony in hosting ASP.NET Core applications IHost? host = CreateHostBuilder(args).Build(); static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { ... }); var builder = WebApplication.CreateBuilder(args); ... WebApplication? app = builder.Build();
  • 9. WebApplication • Reduce the number of callbacks used to configure top level things • Expose top level properties for things people commonly resolve in Startup.Configure. • This allows them to avoid using the service locator pattern for IConfiguration, ILogger, IHostApplicationLifetime. • Merge the IApplicationBuilder, the IEndpointRouteBuilder and the IHost into a single object. • This makes it easy to register middleware and routes without needed an additional level of lambda nesting • Merge the IConfigurationBuilder, IConfiguration, and IConfigurationRoot into a single Configuration type so that we can access configuration while it's being built. • This is important since you often need configuration data as part of configuring services. • UseRouting and UseEndpoints are called automatically (if they haven't already been called) at the beginning and end of the pipeline. "Minimal hosting" for ASP.NET Core applications · Issue #30354 · dotnet/aspnetcore (github.c
  • 10. WebApplication namespace Microsoft.AspNetCore.Builder { // // Summary: // The web application used to configure the HTTP pipeline, and routes. public sealed class WebApplication : IHost, IDisposable, IApplicationBuilder, IEndpointRouteBuilder, IAsyncDisposable { ... } }
  • 11. From 5 to 6 • Migrate from ASP.NET Core 5.0 to 6.0 | Microsoft Docs • .NET 6 ASP.NET Core Migration (github.com) https://gist.github.com/davidfowl/0e0372c3c1d895c3ce195ba983b1e03d
  • 13. Minimal APIs from fastapi import FastAPI import python_weather app = FastAPI() @app.get("/api/weather") async def root(): weather = await python_weather.Client().getAllReports() return weather const express = require("express"); const app = express(); app.get("/api/weather ", (req, res) => { res.send(getAllWeatherReports()); }); // Listen to the App Engine-specified port, or 8080 otherwise const PORT = process.env.PORT || 8080; app.listen(PORT, () => { console.log(`Server listening on port ${PORT}...`); });
  • 14. Minimal APIs var app = WebApplication.CreateBuilder(args).Build(); app.MapGet("/weatherforecast", () => { var forecasts = Enumerable.Range(1, 5).Select(index => ... .ToArray(); return forecasts; })
  • 15. 984 820 425 0 200 400 600 800 1000 1200 Middleware Min API Controller API performance (1k RPS) Performance • HTTP APIs – pay for play • ~5% RPS gain for middleware in .NET 6 • New min API twice as fast as API controllers • Faster JWT authentication • ~40% faster gain in JWT middleware • MVC on Linux • ~12% faster thanks to faster logging • More efficient MemoryCache • ~10% RPS gain on cache TechEmpower benchmark • Reduced memory usage per https connection • ~70% working set reduction for idle WebSocket connections • HTTP/2 & gRPC • Improvements to HttpClient connection management • ~20% faster Protobuf serialization dotNETConf/Roth_ASP.NET_Core_MVC_Razor_Pages_in_.NET6.pptx at master · dotnet-presentations/dotNETConf (github.com)
  • 17. IEnumerable namespace System.Collections.Generic { public interface IEnumerable<out T> : IEnumerable { IEnumerator<T> GetEnumerator(); } public interface IEnumerator<out T> : IDisposable, IEnumerator { bool MoveNext (); T Current { get; } } } var fibNums = new List<int> { 0, 1, 1, 2, 3, 5, 8, 13 }; foreach (int element in fibNums) { Console.Write($"{element} "); } private IEnumerable<int> Fibonacci(int n) { int a = 0; int b = 1; int sum = 0; for (int i = 0; i < n; i++) { yield return a; sum = a + b; a = b; b = sum; } }
  • 18. Iterators and Async namespace System.Collections.Generic { public interface IEnumerable<out T> : IEnumerable { IEnumerator<T> GetEnumerator(); } public interface IEnumerator<out T> : IDisposable, IEnumerator { bool MoveNext (); T Current { get; } } } var fibNums = new List<int> { 0, 1, 1, 2, 3, 5, 8, 13 }; foreach (int element in fibNums) { Console.Write($"{element} "); } private async IEnumerable<int> Fibonacci(int n) { int a = 0; int b = 1; int sum = 0; for (int i = 0; i < n; i++) { await SomeAsyncMethod(); yield return a; sum = a + b; a = b; b = sum; } }
  • 19. IAsyncEnumerable namespace System.Collections.Generic { public interface IAsyncEnumerable<out T> { IAsyncEnumerator<T> GetAsyncEnumerator( CancellationToken cancellationToken = default); } public interface IAsyncEnumerator<out T> : IAsyncDisposable { ValueTask<bool> MoveNextAsync(); T Current { get; } } } namespace System { public interface IAsyncDisposable { ValueTask DisposeAsync(); } } namespace System.Collections.Generic { public interface IEnumerable<out T> : IEnumerable { IEnumerator<T> GetEnumerator(); } public interface IEnumerator<out T> : IDisposable, IEnumerator { bool MoveNext (); T Current { get; } } }
  • 20. Iterators and Async - IAsyncEnumerable var fibNums = Fibonacci(20) await foreach (int element in fibNums) { Console.Write($"{element} "); } private async IAsyncEnumerable<int> Fibonacci(int n) { int a = 0; int b = 1; int sum = 0; for (int i = 0; i < n; i++) { await SomeAsyncMethod(); yield return a; sum = a + b; a = b; b = sum; } } namespace System.Collections.Generic { public interface IAsyncEnumerable<out T> { IAsyncEnumerator<T> GetAsyncEnumerator( CancellationToken cancellationToken = default); } public interface IAsyncEnumerator<out T> : IAsyncDisposable { ValueTask<bool> MoveNextAsync(); T Current { get; } } }
  • 21. New SPA templates SPA Dev Server ASP.NET Core Backend Browser requests goes to Dev Server URL Requests forwarded backend via the Dev Server proxy
  • 22. Summary Simplicity & Productivity • New hosting model • Minimal APIs • Hot reload • Async Streaming Performance • .NET 6 • Network processing • Hosting overhead Better JS FXs Integration • Frameworks versions • Webpack dev server proxy support