SlideShare a Scribd company logo
ASP.NET Core 2.1
Shahed Chowdhuri
Sr. Technical Evangelist @ Microsoft
@shahedC
WakeUpAndCode.com
Cross-Platform Web Apps
Agenda
Introduction
> .NET (Framework & Core)
> ASP.NET Core
> Visual Studio & VS Code
References + Wrap-up
Introduction
ASP.NET
Info and Downloads: http://www.asp.net/
.NET for Cross-Platform Dev
.NET Info + Download: https://www.microsoft.com/net
.NET Across Windows/Web Platforms
http://blogs.msdn.com/b/dotnet/archive/2014/12/04/introducing-net-core.aspx
ASP.NET Core 2.1: The Future of Web Apps
.NET 3.0 in 2019 and Beyond…
https://blogs.msdn.microsoft.com/dotnet/2018/05/07/net-core-3-and-support-for-windows-desktop-applications
ASP.NET
Web API
Active
Server
Pages
(Classic
ASP)
ASP.NET
(Web
Forms)
ASP.NET
MVC
1/2/3/4/5
ASP.NET
Web Pages
Evolution of ASP and ASP .NET
ASP.NET
Core MVC
Unified
MVC, Web
API and
Razor
Web
Pages
Names & Version Numbers
C# 7.x in VS2017
https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/
Agenda
Introduction
> .NET (Framework & Core)
> ASP.NET Core
> Visual Studio & VS Code
References + Wrap-up
.NET Framework
& .NET Core
ASP.NET Core High-Level Overview
Compilation Process
What About .NET Framework 4.6+?
Core is
4.7
ASP .NET Core
ASP.NET Core Features
ASP.NET Core Summary
ASP .NET Core MVC
MVC Web App Basics
Controller
Model
View
User Requests
Updates
Model
Gets
Data
Updates
View
MVC (Web) Controllers
public class HumanController : Controller
{
private readonly ApplicationDbContext _context;
public HumanController(ApplicationDbContext context) {}
// GET: Human, Human/Details/5
public async Task<IActionResult> Index() {}
public async Task<IActionResult> Details(int? id) {}
// GET: Human/Create
public IActionResult Create() {}
// POST: Human
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("Id,FirstName,LastName")] Human human) {}
// GET: Human/Edit/5
public async Task<IActionResult> Edit(int? id) {}
// POST: Human/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("Id,FirstName,LastName")] Human human) {}
}
MVC (API) Controllers
public class ValuesController : Controller
{
// GET: api/Values, api/Values/5
[HttpGet]
public IEnumerable<string> Get() {}
[HttpGet("{id}", Name = "Get")]
public string Get(int id) {}
// POST: api/Values
[HttpPost]
public void Post([FromBody]string value) {}
// PUT: api/Values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value) {}
// DELETE: api/ApiWithActions/5
[HttpDelete("{id}")]
public void Delete(int id) {}
}
MVC (Web) Views
@model NiceStackWeb.Models.Human
@{
ViewData["Title"] = "Details";
}
<h2>Details</h2>
<div>
<h4>Human</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.FirstName)
</dt>
<dd>
@Html.DisplayFor(model => model.FirstName)
</dd> ...
</dl>
</div>
<div>
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
<a asp-action="Index">Back to List</a>
</div>
MVC Models
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
public class Human
{
[Key]
public int Id { get; set; }
[DisplayName("First Name")]
public string FirstName { get; set; }
[DisplayName("First Name")]
public string LastName { get; set; }
}
New Razor Pages!
http://www.hishambinateya.com/welcome-razor-pages
Intro to Razor Pages
https://docs.microsoft.com/en-us/aspnet/core/mvc/razor-pages
Razor Syntax
SignalR in ASP.NET Core 2.1 (Stable!)
https://blogs.msdn.microsoft.com/webdev/2018/02/27/asp-net-core-2-1-0-preview1-getting-started-with-signalr
using Microsoft.AspNetCore.SignalR;
namespace SignalRTutorial.Hubs
{
[Authorize]
public class ChatHub : Hub
{
public override async Task OnConnectedAsync()
{
await Clients.All.SendAsync("SendAction", Context.User.Identity.Name, "joined");
}
public override async Task OnDisconnectedAsync(Exception ex)
{
await Clients.All.SendAsync("SendAction", Context.User.Identity.Name, "left");
}
public async Task Send(string message)
{
await Clients.All.SendAsync("SendMessage", Context.User.Identity.Name, message);
}
}
}
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• Real-time web development
• New Typescript client, jQuery
• Built-in Hub protocols:
• JSON-based for text
• MessagePack for binary
• Improved scale-out model
• Sticky sessions required*
*required when using WebSockets unless
skipNegotiation flag is set to true
var connection = new
signalR.HubConnectionBuilder().withUrl("/chat",
{
skipNegotiation: true,
transport: signalR.HttpTransportType.WebSockets
})
.build();
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• UseHttpsRedirection by default
• HSTS protocol support (non-dev)
• >dotnet dev-certs https --trust
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• New ApiController attribute
• Auto model validation
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• Rich Swagger support
• Easier API documentation
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• New type ActionResult<T>
• Indicate response type for any
action result
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• HttpClient as a service
• Register, configure, consume
HttpClient instances
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• ASP.NET Core (native IIS) Module
• Hooks into IIS pipeline
• Improved Performance
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• Default UI implemented in a library
• Available as NuGet package
• Enable via Startup class
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• Compliance for EU General Data
Protection Regulation reqts
• Request user consent for info
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• Mix authentication schemes
• e.g. Bearer tokens, cookie auth
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• Compiled during build process
• Improved startup performance
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• Razor UI as class library
• Share across projects
• Share as Nuget package
ASP.NET Core 2.1: What’s New?
http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
• Improved end-to-end testing
• e.g. routing, filters, controllers,
actions, views and pages
How about Entity Framework?
DB
ORM
Entities
in Code
Core
)
4.6+
4.6+
ASP.NET Core 2.1: The Future of Web Apps
Pluralsight Course by Julie Lerman
https://app.pluralsight.com/library/courses/entity-framework-core-2-getting-started
Visual Studio 2017
& VS Code
New Installer!
File  New Project  Web
• ASP .NET Core Web App
• Web App (4.x)
Select a Template
1.0 , 1.1, 2.0 or 2.1
• Empty
• API
• Web App (Razor)
• Web App (MVC)
• Angular
• React.js
• React.js & Redux
• Razor Class Library
Other settings:
• Authentication
• Docker Support
VS 2017 15.7 + ASP.NET Core 2.1
https://www.visualstudio.com/downloads
.NET Core SDK 2.1 RC1
https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300-rc1
Select a Template (VS 2017 15.7)
Includes:
ASP .NET Core 2.1
ASP.NET Core Runtime Extension on Azure
https://blogs.msdn.microsoft.com/webdev/2018/02/27/asp-net-core-2-1-0-preview1-using-asp-net-core-previews-on-azure-app-service/
Visual Studio Code
Download https://code.visualstudio.com
Startup.cs Configuration
project.json
.csproj project file 2.0
.csproj project file 2.1
Right-click  (Project) Properties
Choose Profile While Debugging
Live Unit Testing
https://blogs.msdn.microsoft.com/visualstudio/2016/11/18/live-unit-testing-visual-studio-2017-rc/
DEMO
Migrating from MVC to MVC Core
https://docs.microsoft.com/en-us/aspnet/core/migration/mvc
dotnet/cli on GitHub
This repo
contains
the .NET
Core
command-
line (CLI)
tools, used
for
building
.NET Core
apps and
libraries.
GitHub: https://github.com/dotnet/cli
.NET Core 2.x CLI Commands
https://docs.microsoft.com/en-us/dotnet/core/tools/?tabs=netcore2x
>dotnet --version
>dotnet --info
>dotnet new <TEMPLATE> --auth <AUTH_TYPE> -o <OUTPUT_DIR>
>dotnet new console -o MyConsoleApp
>dotnet new mvc --auth Individual -o MyMvcWebApp
>dotnet restore
>dotnet build
>dotnet run
<TEMPLATE> = web | mvc | razor | angular | react | webapi
<AUTH_TYPE> for mvc,razor = None | Individual | SingleOrg | Windows
Azure CLI Commands
https://docs.microsoft.com/en-us/azure/app-service/scripts/app-service-cli-deploy-github
>az login
>az group create -l <REGION> -n <RSG>
>az appservice plan create -g <RSG> -n <ASP> --sku <PLAN> (e.g. F1)
>az webapp create -g <RSG> -p <ASP> -n <APP>
>git init
>git add .
>git commit -m "<COMMIT MESSAGE>“
>az webapp deployment user set --user-name <USER>
>az webapp deployment source config-local-git -g <RSG> -n <APP> --out tsv
>git remote add azure <GIT URL>
>git push azure master
RESULT  http://<APP>.azurewebsites.net
GIT URL  https://<USER>@<APP>.scm.azurewebsites.net/<APP>.git
Agenda
Introduction
> .NET (Framework & Core)
> ASP.NET Core
> Visual Studio & VS Code
References + Wrap-up
References
& Wrap-up
Blog Sources
Scott Hanselman’s Blog: https://www.hanselman.com/blog/
.NET Web Dev Blog: https://blogs.msdn.microsoft.com/webdev/
Visual Studio 2017 Launch Videos
https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch?sort=viewed&direction=asc
Build 2017: ASP .NET Core 2.0
https://channel9.msdn.com/Events/Build/2017/b8048
.NET Core 2.1 Roadmap PT.1
https://channel9.msdn.com/Shows/On-NET/NET-Core-21-Roadmap-PT1
.NET Core 2.1 Roadmap PT.2
https://channel9.msdn.com/Shows/On-NET/NET-Core-21-Roadmap-PT2
Build Conference 2018 http://build.microsoft.com
Build 2018: ASP .NET Core 2.1
https://channel9.msdn.com/events/Build/2018/BRK2151
SignalR for ASP .NET Core 2.1
https://channel9.msdn.com/events/Build/2018/BRK2147
Jeff Fritz on YouTube
https://www.youtube.com/watch?v=--lYHxrsLsc
Other Video Sources
MSDN Channel 9: https://channel9.msdn.com
.NET Conf: http://www.dotnetconf.net
Docs + Tutorials
Tutorials: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/
Docs: https://blogs.msdn.microsoft.com/webdev/2017/02/07/asp-net-documentation-now-on-docs-microsoft-com/
ASP.NET Core 2.0 Release
https://blogs.msdn.microsoft.com/webdev/2017/08/14/announcing-asp-net-core-2-0/
ASP.NET Core 2.1 Roadmap
https://blogs.msdn.microsoft.com/webdev/2018/02/02/asp-net-core-2-1-roadmap/
.NET Core Roadmap
https://github.com/dotnet/core/blob/master/roadmap.md
ASP.NET Core 2.1 Released
https://blogs.msdn.microsoft.com/dotnet/2018/05/30/announcing-net-core-2-1/
References
• ASP .NET: http://www.asp.net
• .NET Core: https://www.microsoft.com/net
• .NET Web Dev Blog: https://blogs.msdn.microsoft.com/webdev
• Scott Hanselman’s Blog: https://www.hanselman.com/blog
• .NET Conf: http://www.dotnetconf.net
• MSDN Channel 9: https://channel9.msdn.com
• Tutorials: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app
• C# 7: https://docs.microsoft.com/en-us/dotnet/articles/csharp/csharp-7
• ASP.NET Core Roadmap: https://github.com/aspnet/Home/wiki/Roadmap
• .NET Core Roadmap: https://github.com/dotnet/core/blob/master/roadmap.md
Other Resources
• New Razor Pages: http://www.hishambinateya.com/welcome-razor-pages
• Intro to Razor: https://docs.microsoft.com/en-us/aspnet/core/mvc/razor-pages
• Live Unit Testing: https://blogs.msdn.microsoft.com/visualstudio/2016/11/18/live-
unit-testing-visual-studio-2017-rc
• Migrating from MVC to MVC Core: https://docs.microsoft.com/en-
us/aspnet/core/migration/mvc
• Visual Studio Code: https://code.visualstudio.com
• dotnet/cli on GitHub: https://github.com/dotnet/cli
Q & A
Agenda
Introduction
> .NET (Framework & Core)
> ASP.NET Core
> Visual Studio & VS Code
References + Wrap-up
Email: shchowd@microsoft.com  Twitter: @shahedC

More Related Content

PPTX
ASP.NET Core 2.1: The Future of Web Apps
PPTX
ASP.NET Core MVC + Web API with Overview
PPTX
ASP.NET Core 2.1: The Future of Web Apps
PPTX
Introducing ASP.NET Core 2.0
PPTX
ASP.NET Core MVC + Web API with Overview (Post RC2)
PPTX
ASP.NET Core MVC + Web API with Overview
PPTX
Introduction to ASP.NET Core
PPTX
ASP.NET Core: The best of the new bits
ASP.NET Core 2.1: The Future of Web Apps
ASP.NET Core MVC + Web API with Overview
ASP.NET Core 2.1: The Future of Web Apps
Introducing ASP.NET Core 2.0
ASP.NET Core MVC + Web API with Overview (Post RC2)
ASP.NET Core MVC + Web API with Overview
Introduction to ASP.NET Core
ASP.NET Core: The best of the new bits

What's hot (20)

PPTX
Learning ASP.NET 5 and MVC 6
PPTX
PHP konferencija - Microsoft
PPTX
Php On Windows
PDF
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
PDF
Joe Staner Zend Con 2008
PDF
Asp.Net Core MVC , Razor page , Entity Framework Core
PPTX
MVC 6 Introduction
PPTX
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
PPT
OWIN (Open Web Interface for .NET)
PDF
Introduction to ASP.NET Core
PPTX
Moving forward with ASP.NET Core
PPTX
Evolution / History of ASP.NET
PDF
Require js training
PPTX
Microsoft Azure WebJobs
PPT
TDD with ASP.NET MVC 1.0
PPTX
Owin and Katana
PDF
Securing applications
PPTX
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
PPTX
DEV208 - ASP.NET MVC 5 新功能探索
PPT
Introduction to ASP.NET MVC 1.0
Learning ASP.NET 5 and MVC 6
PHP konferencija - Microsoft
Php On Windows
Getting Started with ASP.NET Core 1.0 (formerly ASP.NET 5)
Joe Staner Zend Con 2008
Asp.Net Core MVC , Razor page , Entity Framework Core
MVC 6 Introduction
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
OWIN (Open Web Interface for .NET)
Introduction to ASP.NET Core
Moving forward with ASP.NET Core
Evolution / History of ASP.NET
Require js training
Microsoft Azure WebJobs
TDD with ASP.NET MVC 1.0
Owin and Katana
Securing applications
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
DEV208 - ASP.NET MVC 5 新功能探索
Introduction to ASP.NET MVC 1.0
Ad

Similar to ASP.NET Core 2.1: The Future of Web Apps (20)

PPTX
ASP.NET Core 2.0: The Future of Web Apps
PPTX
ASP.NET Core 1.0 Overview
PPTX
ASP .Net Core SPA Templates
PPTX
ASP.NET Core 1.0 Overview
PPTX
.NET Fest 2017. Андрей Антиликаторов. Проектирование и разработка приложений ...
PPTX
ASP.NET Core 1.0 Overview: Post-RC2
PPTX
Deploying windows containers with kubernetes
PPTX
ASP.NET Presentation
PPTX
ASP.NET Core 1.0 Overview: Pre-RC2
PPTX
The next step from Microsoft - Vnext (Srdjan Poznic)
PPTX
Websites, Web Services and Cloud Applications with Visual Studio
PPTX
ASP.NET Core 1.0
PPTX
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
PPTX
Vijay Oscon
PDF
.NET Core, ASP.NET Core Course, Session 18
PPTX
Best of Microsoft Dev Camp 2015
PPTX
SoCal Code Camp 2011 - ASP.NET MVC 4
PPTX
OWIN and Katana Project - Not Only IIS - NoIIS
PDF
SPUnite17 Building Great Client Side Web Parts with SPFx
ASP.NET Core 2.0: The Future of Web Apps
ASP.NET Core 1.0 Overview
ASP .Net Core SPA Templates
ASP.NET Core 1.0 Overview
.NET Fest 2017. Андрей Антиликаторов. Проектирование и разработка приложений ...
ASP.NET Core 1.0 Overview: Post-RC2
Deploying windows containers with kubernetes
ASP.NET Presentation
ASP.NET Core 1.0 Overview: Pre-RC2
The next step from Microsoft - Vnext (Srdjan Poznic)
Websites, Web Services and Cloud Applications with Visual Studio
ASP.NET Core 1.0
Creating Dynamic Web Application Using ASP.Net 3 5_MVP Alezandra Buencamino N...
Vijay Oscon
.NET Core, ASP.NET Core Course, Session 18
Best of Microsoft Dev Camp 2015
SoCal Code Camp 2011 - ASP.NET MVC 4
OWIN and Katana Project - Not Only IIS - NoIIS
SPUnite17 Building Great Client Side Web Parts with SPFx
Ad

More from Shahed Chowdhuri (20)

PPTX
Cloud-Backed Mixed Reality: HoloLens & Azure Cognitive Services
PPTX
Cloud-Backed Mixed Reality with HoloLens & Azure Cognitive Services
PPTX
Microsoft Cognitive Services
PPTX
Intro to Bot Framework v3 with DB
PPTX
Game On with Windows & Xbox One @ .NET Conf UY
PPTX
Game On with Windows & Xbox One!
PPTX
Going Serverless with Azure Functions
PPTX
Azure for Hackathons
PPTX
Intro to Xamarin: Cross-Platform Mobile Application Development
PPTX
Xbox One Dev Mode
PPTX
What's New at Microsoft?
PPTX
Capture the Cloud with Azure
PPTX
Intro to HoloLens Development + Windows Mixed Reality
PPTX
Intro to Bot Framework v3
PPTX
Azure: PaaS or IaaS
PPTX
Capture the Cloud with Azure
PPTX
Intro to HoloLens Development
PPTX
Intro to Bot Framework
PPTX
Xbox One Dev Mode
PPTX
Intro to Xamarin
Cloud-Backed Mixed Reality: HoloLens & Azure Cognitive Services
Cloud-Backed Mixed Reality with HoloLens & Azure Cognitive Services
Microsoft Cognitive Services
Intro to Bot Framework v3 with DB
Game On with Windows & Xbox One @ .NET Conf UY
Game On with Windows & Xbox One!
Going Serverless with Azure Functions
Azure for Hackathons
Intro to Xamarin: Cross-Platform Mobile Application Development
Xbox One Dev Mode
What's New at Microsoft?
Capture the Cloud with Azure
Intro to HoloLens Development + Windows Mixed Reality
Intro to Bot Framework v3
Azure: PaaS or IaaS
Capture the Cloud with Azure
Intro to HoloLens Development
Intro to Bot Framework
Xbox One Dev Mode
Intro to Xamarin

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Encapsulation theory and applications.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
A Presentation on Artificial Intelligence
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Tartificialntelligence_presentation.pptx
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
August Patch Tuesday
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPT
Teaching material agriculture food technology
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation_ Review paper, used for researhc scholars
TLE Review Electricity (Electricity).pptx
Encapsulation theory and applications.pdf
A comparative study of natural language inference in Swahili using monolingua...
Spectral efficient network and resource selection model in 5G networks
A Presentation on Artificial Intelligence
Empathic Computing: Creating Shared Understanding
Tartificialntelligence_presentation.pptx
OMC Textile Division Presentation 2021.pptx
1. Introduction to Computer Programming.pptx
August Patch Tuesday
Digital-Transformation-Roadmap-for-Companies.pptx
Machine learning based COVID-19 study performance prediction
MIND Revenue Release Quarter 2 2025 Press Release
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Teaching material agriculture food technology
Building Integrated photovoltaic BIPV_UPV.pdf
Getting Started with Data Integration: FME Form 101
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

ASP.NET Core 2.1: The Future of Web Apps

  • 1. ASP.NET Core 2.1 Shahed Chowdhuri Sr. Technical Evangelist @ Microsoft @shahedC WakeUpAndCode.com Cross-Platform Web Apps
  • 2. Agenda Introduction > .NET (Framework & Core) > ASP.NET Core > Visual Studio & VS Code References + Wrap-up
  • 4. ASP.NET Info and Downloads: http://www.asp.net/
  • 5. .NET for Cross-Platform Dev .NET Info + Download: https://www.microsoft.com/net
  • 6. .NET Across Windows/Web Platforms http://blogs.msdn.com/b/dotnet/archive/2014/12/04/introducing-net-core.aspx
  • 8. .NET 3.0 in 2019 and Beyond… https://blogs.msdn.microsoft.com/dotnet/2018/05/07/net-core-3-and-support-for-windows-desktop-applications
  • 9. ASP.NET Web API Active Server Pages (Classic ASP) ASP.NET (Web Forms) ASP.NET MVC 1/2/3/4/5 ASP.NET Web Pages Evolution of ASP and ASP .NET ASP.NET Core MVC Unified MVC, Web API and Razor Web Pages
  • 10. Names & Version Numbers
  • 11. C# 7.x in VS2017 https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/
  • 12. Agenda Introduction > .NET (Framework & Core) > ASP.NET Core > Visual Studio & VS Code References + Wrap-up
  • 16. What About .NET Framework 4.6+? Core is 4.7
  • 21. MVC Web App Basics Controller Model View User Requests Updates Model Gets Data Updates View
  • 22. MVC (Web) Controllers public class HumanController : Controller { private readonly ApplicationDbContext _context; public HumanController(ApplicationDbContext context) {} // GET: Human, Human/Details/5 public async Task<IActionResult> Index() {} public async Task<IActionResult> Details(int? id) {} // GET: Human/Create public IActionResult Create() {} // POST: Human [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> Create([Bind("Id,FirstName,LastName")] Human human) {} // GET: Human/Edit/5 public async Task<IActionResult> Edit(int? id) {} // POST: Human/Edit/5 [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> Edit(int id, [Bind("Id,FirstName,LastName")] Human human) {} }
  • 23. MVC (API) Controllers public class ValuesController : Controller { // GET: api/Values, api/Values/5 [HttpGet] public IEnumerable<string> Get() {} [HttpGet("{id}", Name = "Get")] public string Get(int id) {} // POST: api/Values [HttpPost] public void Post([FromBody]string value) {} // PUT: api/Values/5 [HttpPut("{id}")] public void Put(int id, [FromBody]string value) {} // DELETE: api/ApiWithActions/5 [HttpDelete("{id}")] public void Delete(int id) {} }
  • 24. MVC (Web) Views @model NiceStackWeb.Models.Human @{ ViewData["Title"] = "Details"; } <h2>Details</h2> <div> <h4>Human</h4> <hr /> <dl class="dl-horizontal"> <dt> @Html.DisplayNameFor(model => model.FirstName) </dt> <dd> @Html.DisplayFor(model => model.FirstName) </dd> ... </dl> </div> <div> <a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> | <a asp-action="Index">Back to List</a> </div>
  • 25. MVC Models using System.ComponentModel; using System.ComponentModel.DataAnnotations; public class Human { [Key] public int Id { get; set; } [DisplayName("First Name")] public string FirstName { get; set; } [DisplayName("First Name")] public string LastName { get; set; } }
  • 27. Intro to Razor Pages https://docs.microsoft.com/en-us/aspnet/core/mvc/razor-pages
  • 29. SignalR in ASP.NET Core 2.1 (Stable!) https://blogs.msdn.microsoft.com/webdev/2018/02/27/asp-net-core-2-1-0-preview1-getting-started-with-signalr using Microsoft.AspNetCore.SignalR; namespace SignalRTutorial.Hubs { [Authorize] public class ChatHub : Hub { public override async Task OnConnectedAsync() { await Clients.All.SendAsync("SendAction", Context.User.Identity.Name, "joined"); } public override async Task OnDisconnectedAsync(Exception ex) { await Clients.All.SendAsync("SendAction", Context.User.Identity.Name, "left"); } public async Task Send(string message) { await Clients.All.SendAsync("SendMessage", Context.User.Identity.Name, message); } } }
  • 30. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/
  • 31. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • Real-time web development • New Typescript client, jQuery • Built-in Hub protocols: • JSON-based for text • MessagePack for binary • Improved scale-out model • Sticky sessions required* *required when using WebSockets unless skipNegotiation flag is set to true var connection = new signalR.HubConnectionBuilder().withUrl("/chat", { skipNegotiation: true, transport: signalR.HttpTransportType.WebSockets }) .build();
  • 32. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • UseHttpsRedirection by default • HSTS protocol support (non-dev) • >dotnet dev-certs https --trust
  • 33. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • New ApiController attribute • Auto model validation
  • 34. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • Rich Swagger support • Easier API documentation
  • 35. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • New type ActionResult<T> • Indicate response type for any action result
  • 36. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • HttpClient as a service • Register, configure, consume HttpClient instances
  • 37. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • ASP.NET Core (native IIS) Module • Hooks into IIS pipeline • Improved Performance
  • 38. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • Default UI implemented in a library • Available as NuGet package • Enable via Startup class
  • 39. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • Compliance for EU General Data Protection Regulation reqts • Request user consent for info
  • 40. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • Mix authentication schemes • e.g. Bearer tokens, cookie auth
  • 41. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • Compiled during build process • Improved startup performance
  • 42. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • Razor UI as class library • Share across projects • Share as Nuget package
  • 43. ASP.NET Core 2.1: What’s New? http://www.talkingdotnet.com/quick-summary-whats-new-asp-net-core-2-1/ • Improved end-to-end testing • e.g. routing, filters, controllers, actions, views and pages
  • 44. How about Entity Framework? DB ORM Entities in Code Core ) 4.6+ 4.6+
  • 46. Pluralsight Course by Julie Lerman https://app.pluralsight.com/library/courses/entity-framework-core-2-getting-started
  • 49. File  New Project  Web • ASP .NET Core Web App • Web App (4.x)
  • 50. Select a Template 1.0 , 1.1, 2.0 or 2.1 • Empty • API • Web App (Razor) • Web App (MVC) • Angular • React.js • React.js & Redux • Razor Class Library Other settings: • Authentication • Docker Support
  • 51. VS 2017 15.7 + ASP.NET Core 2.1 https://www.visualstudio.com/downloads
  • 52. .NET Core SDK 2.1 RC1 https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300-rc1
  • 53. Select a Template (VS 2017 15.7) Includes: ASP .NET Core 2.1
  • 54. ASP.NET Core Runtime Extension on Azure https://blogs.msdn.microsoft.com/webdev/2018/02/27/asp-net-core-2-1-0-preview1-using-asp-net-core-previews-on-azure-app-service/
  • 55. Visual Studio Code Download https://code.visualstudio.com
  • 61. Choose Profile While Debugging
  • 63. DEMO
  • 64. Migrating from MVC to MVC Core https://docs.microsoft.com/en-us/aspnet/core/migration/mvc
  • 65. dotnet/cli on GitHub This repo contains the .NET Core command- line (CLI) tools, used for building .NET Core apps and libraries. GitHub: https://github.com/dotnet/cli
  • 66. .NET Core 2.x CLI Commands https://docs.microsoft.com/en-us/dotnet/core/tools/?tabs=netcore2x >dotnet --version >dotnet --info >dotnet new <TEMPLATE> --auth <AUTH_TYPE> -o <OUTPUT_DIR> >dotnet new console -o MyConsoleApp >dotnet new mvc --auth Individual -o MyMvcWebApp >dotnet restore >dotnet build >dotnet run <TEMPLATE> = web | mvc | razor | angular | react | webapi <AUTH_TYPE> for mvc,razor = None | Individual | SingleOrg | Windows
  • 67. Azure CLI Commands https://docs.microsoft.com/en-us/azure/app-service/scripts/app-service-cli-deploy-github >az login >az group create -l <REGION> -n <RSG> >az appservice plan create -g <RSG> -n <ASP> --sku <PLAN> (e.g. F1) >az webapp create -g <RSG> -p <ASP> -n <APP> >git init >git add . >git commit -m "<COMMIT MESSAGE>“ >az webapp deployment user set --user-name <USER> >az webapp deployment source config-local-git -g <RSG> -n <APP> --out tsv >git remote add azure <GIT URL> >git push azure master RESULT  http://<APP>.azurewebsites.net GIT URL  https://<USER>@<APP>.scm.azurewebsites.net/<APP>.git
  • 68. Agenda Introduction > .NET (Framework & Core) > ASP.NET Core > Visual Studio & VS Code References + Wrap-up
  • 70. Blog Sources Scott Hanselman’s Blog: https://www.hanselman.com/blog/ .NET Web Dev Blog: https://blogs.msdn.microsoft.com/webdev/
  • 71. Visual Studio 2017 Launch Videos https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch?sort=viewed&direction=asc
  • 72. Build 2017: ASP .NET Core 2.0 https://channel9.msdn.com/Events/Build/2017/b8048
  • 73. .NET Core 2.1 Roadmap PT.1 https://channel9.msdn.com/Shows/On-NET/NET-Core-21-Roadmap-PT1
  • 74. .NET Core 2.1 Roadmap PT.2 https://channel9.msdn.com/Shows/On-NET/NET-Core-21-Roadmap-PT2
  • 75. Build Conference 2018 http://build.microsoft.com
  • 76. Build 2018: ASP .NET Core 2.1 https://channel9.msdn.com/events/Build/2018/BRK2151
  • 77. SignalR for ASP .NET Core 2.1 https://channel9.msdn.com/events/Build/2018/BRK2147
  • 78. Jeff Fritz on YouTube https://www.youtube.com/watch?v=--lYHxrsLsc
  • 79. Other Video Sources MSDN Channel 9: https://channel9.msdn.com .NET Conf: http://www.dotnetconf.net
  • 80. Docs + Tutorials Tutorials: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/ Docs: https://blogs.msdn.microsoft.com/webdev/2017/02/07/asp-net-documentation-now-on-docs-microsoft-com/
  • 81. ASP.NET Core 2.0 Release https://blogs.msdn.microsoft.com/webdev/2017/08/14/announcing-asp-net-core-2-0/
  • 82. ASP.NET Core 2.1 Roadmap https://blogs.msdn.microsoft.com/webdev/2018/02/02/asp-net-core-2-1-roadmap/
  • 84. ASP.NET Core 2.1 Released https://blogs.msdn.microsoft.com/dotnet/2018/05/30/announcing-net-core-2-1/
  • 85. References • ASP .NET: http://www.asp.net • .NET Core: https://www.microsoft.com/net • .NET Web Dev Blog: https://blogs.msdn.microsoft.com/webdev • Scott Hanselman’s Blog: https://www.hanselman.com/blog • .NET Conf: http://www.dotnetconf.net • MSDN Channel 9: https://channel9.msdn.com • Tutorials: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app • C# 7: https://docs.microsoft.com/en-us/dotnet/articles/csharp/csharp-7 • ASP.NET Core Roadmap: https://github.com/aspnet/Home/wiki/Roadmap • .NET Core Roadmap: https://github.com/dotnet/core/blob/master/roadmap.md
  • 86. Other Resources • New Razor Pages: http://www.hishambinateya.com/welcome-razor-pages • Intro to Razor: https://docs.microsoft.com/en-us/aspnet/core/mvc/razor-pages • Live Unit Testing: https://blogs.msdn.microsoft.com/visualstudio/2016/11/18/live- unit-testing-visual-studio-2017-rc • Migrating from MVC to MVC Core: https://docs.microsoft.com/en- us/aspnet/core/migration/mvc • Visual Studio Code: https://code.visualstudio.com • dotnet/cli on GitHub: https://github.com/dotnet/cli
  • 87. Q & A
  • 88. Agenda Introduction > .NET (Framework & Core) > ASP.NET Core > Visual Studio & VS Code References + Wrap-up
  • 89. Email: [email protected] Twitter: @shahedC

Editor's Notes