Introduction to ASP.NET Core Jordan Knight Technical Evangelist, Microsoft
Workloads evolution .NET 5/11/2018 Multi- Framework .NET Core Desktop & ASP.NET Windows Mobile Browsers & Win Phone Windows Store ASP.NET Core Framework Compact Framework Silverlight .NET Core Multi- Framework © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
The .NET Family .NET FRAMEWORK .NET CORE XAMARIN Platform for .NET applications on Windows .NET CORE Cross-platform and open source framework optimized for modern app needs and developer workflows XAMARIN Cross-platform and open source Mono-based runtime for iOS, OS X, and Android devices Distributed with Windows Distributed with app
Fully Open Source .NET Core and ASP.NET Core are fully open source. 5/11/2018 12:15 AM Fully Open Source .NET Core and ASP.NET Core are fully open source. Microsoft communities are among the most populous https://github.com/aspnet https://github.com/dotnet Microsoft Ignite © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
ASP.NET Core and the Modern Web 5/11/2018 ASP.NET Core and the Modern Web Totally Modular Faster Development Cycle Seamless transition from on-premises to cloud Choose your Editors and Tools Open Source with Contributions Cross-Platform Fast © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Main Features … that won’t be covered today 5/11/2018 12:15 AM Main Features … that won’t be covered today WebAPI MVC Razor Helper Tags (awesome!!) Visual Studio Code DevOps … the usual things https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Areas covered today Cross Platform Project Creation 5/11/2018 Areas covered today Project Creation New (old) Project System Composition Settings OWIN Docker Cross Platform © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Project Creation Jordan Knight Microsoft Ignite 2016 5/11/2018 12:15 AM Project Creation Jordan Knight © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
“dotnet new” Flexible Creation of Projects 5/11/2018 12:15 AM “dotnet new” Flexible Creation of Projects Console Apps Class Libraries Unit test projects ASP.NET Core Web, MVC, WebApi Solution Files https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Composition Jordan Knight Microsoft Ignite 2016 5/11/2018 12:15 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Composition ASP.NET Core apps are composed 5/11/2018 12:15 AM Composition ASP.NET Core apps are composed Start with nothing much Add references via Nuget Configure dependencies Configure the app https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Light Weight ASP.NET Core can run super light 5/11/2018 12:15 AM Light Weight ASP.NET Core can run super light We don’t always need a full featured web stack Can quickly add required features services.AddRouting(); Create light weight services that do specific tasks Terse, elegant https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Settings Jordan Knight Microsoft Ignite 2016 5/11/2018 12:15 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Settings Strongly typed, JSON stored. 5/11/2018 12:15 AM Settings Strongly typed, JSON stored. Main settings file is now appsettings.json Simple POCO settings classes Settings are configured in ConfigureServices services.Configure<ApiKeySettings>(Configuration.GetSection("ApiKeySettings")); Settings can be injected (more on this later) https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
OWIN and DI Jordan Knight Microsoft Ignite 2016 5/11/2018 12:15 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
OWIN So you don’t need to care about the server 5/11/2018 12:15 AM OWIN So you don’t need to care about the server Runs as a pipe, each element calls the next… … unless they decide not to Elements can return, modify the pipline The elements are called middleware You can use the plentiful pre-defined ones – or roll your own. … or both app.UseJwtBearerAuthentication(new JwtBearerOptions { AutomaticAuthenticate = true, AutomaticChallenge = true, TokenValidationParameters = tokenValidationParameters }); https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Dependency Injection ASP.NET Core is very DI friendly 5/11/2018 12:15 AM Dependency Injection ASP.NET Core is very DI friendly Configure services in ConfigureServices () AddScoped, AddSingleton and AddTransient Watch your scopes You can inject framework services, or your own https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Cross Platform Jordan Knight Microsoft Ignite 2016 5/11/2018 12:15 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Cross Platform ASP.NET Core runs on Linux, Mac, Windows 5/11/2018 12:15 AM Cross Platform ASP.NET Core runs on Linux, Mac, Windows Also run’s on ARM based devices Kestrel hosts, use reverse proxy to expose https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Containers Docker has excellent tooling support 5/11/2018 12:15 AM Containers Docker has excellent tooling support Tooling in VS Can debug in to running containers Containers are actively maintained https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Questions? @jakkaj jordan.knight@microsoft.com github.com/jakkaj 5/11/2018 12:15 AM Questions? @jakkaj jordan.knight@microsoft.com github.com/jakkaj https://github.com/jakkaj/Presentation-ASP.NET-Core-Ignite-2017 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Continue your Ignite learning path 5/11/2018 12:15 AM Continue your Ignite learning path Visit Channel 9 to access a wide range of Microsoft training and event recordings https://channel9.msdn.com/ Head to the TechNet Eval Centre to download trials of the latest Microsoft products http://Microsoft.com/en-us/evalcenter/ Visit Microsoft Virtual Academy for free online training visit https://www.microsoftvirtualacademy.com © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Win a Spark After Dark drone pilot pass by completing your session evaluation ASAP #MSAUIGNITE
Thank you Chat with me in the Speaker Lounge 5/11/2018 12:15 AM Thank you Chat with me in the Speaker Lounge © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.