470 likes | 5.05k Views
ASP.NET Core. Understanding the landscape. @ Dave_Paquette Microsoft MVP (Developer Technologies) contactme@davepaquette.com https://www.davepaquette.com. ASP.NET – A Brief History. File New Project in 2005. File – New Project in 2013. File – New Project 2019. Dotnet new in 2019.
E N D
ASP.NET Core Understanding the landscape @Dave_Paquette Microsoft MVP (Developer Technologies) contactme@davepaquette.com https://www.davepaquette.com
Programing models • MVC • Razor Pages • Blazor • Endpoint Routing • Middleware • gRPC • Worker Service • WebApi • SignalR
What makes an asp.net core app? • .NET Core Console App • A web host and a request pipeline
Hello world – Endpoint Routing > dotnet new web • The simplest pipeline for processing HTTP requests • Similar to Nancy (.NET) and ExpressJS (Node)
MVC > dotnet new mvc • Requests are routed to methods (actions) on a Controller class • Controllers load data (models) and potentially return data or a view • The Razor view engine can be used to generate HTML on the server and return that to the client
Razor pages > dotnet new webapp • Built on top of MVC • A simpler programming model for most use cases • Page consists of a CSHTML (Razor) page and a PageModel class
Asp.NET Backend / Javascript frontend > dotnet new angular > dotnet new react > dotnet new reactredux > dotnet new webapi • MVC (without the V) for the backend API • JavaScript framework for the front end
blazor > dotnet new blazorserver • Component based UI framework using on Razor and C# • Web Assembly (Mono .NET Runtime)
Blazor Server Side Client Side
Blazor demos • https://try.dot.net / https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/intro-to-csharp/hello-world • https://github.com/AdrienTorris/awesome-blazor
grpc > dotnet new grpc • Google RPC (Remote Procedure Call) • Contract based service-to-service communication • High performance but not human readable transport
Worker service > dotnet new worker • Any service that runs on a schedule or in a background
Real-Time with Signalr • Real time communication • Server sends messages to the clients
Combining programing models > dotnet new web • Start with the “empty” project and add the pieces you need • E.g. Worker + SignalR
Deployment and hosting • Windows or Linux • Kestrel or IIS (In process or out of process) • Docker • Cloud
Windows Hosting • IIS • Install the .NET Core Hosting Bundle • In Process vs Out of Process • Windows Service
Linux hosting • Run Kestrel as an edge server • Use a common web server like nginx or Apache
Cloud hosting • Use a Virtual Machine • Full PaaS – App Service • Containers
Why Linux? Cons No experience on staff Not as approachable for Windows folks Pros • Cheaper • More portable • More DevOps tools • More experience on staff • Smaller containers • Raspberry Pi • Less overhead
Why Windows? Cons Large container sizes More overhead Pros • More experience on staff • Access to Windows only libraries • Better (more mature) diagnostics and profiling
Thanks! www.davepaquette.com westerndevs.com aspnetmonsters.com Blog(s) Twitter @Dave_Paquette Email contactme@davepaquette.com