asp.net core deployment options
TRANSCRIPT
Deploying ASP.NET Core Applications Ken Cenerelli
Microsoft MVP
@KenCenerelli#ASPNETCore, #DetroitDevDay
ABOUT ME
Twitter: @KenCenerelliEmail: [email protected]: kencenerelli.wordpress.comLinkedIn:
linkedin.com/in/kencenerelli
Content Developer / Programmer Writer
Microsoft MVP - Visual Studio and Development Technologies
Microsoft TechNet Wiki Guru Co-Organizer of CTTDNUG Technical reviewer of multiple books
CTTDNUG
Ken Cenerelli
2
ASP.NET Core (previously ASP.NET 5)
A new open-source and cross-platform framework for building
modern cloud-based Web applications using .NET
ASP.NET Core in a Nutshell
.NET Framework .NET Core Platform for .NET applications on Windows Cross-platform, modular libraries &
runtime optimized for server and cloud workloads
ASP.NET 4.6(System.Web)
MVC ASP.NET Core MVC
ASP.NET Core 1.0(Microsoft.AspNetCore)
Web API
WebForms
ASP.NET Core featuresHostingKestrel, StartupMiddlewareRouting, authentication, static files, diagnostics, error handling, session, CORS, localization, customDependency InjectionConfigurationLoggingApplication frameworksMVC, Identity, SignalR (future)
Getting from development to production
Development
Production
Getting started with .NET Core (dev builds)Install the .NET Core SDKGetting started: dot.net Latest dev build: https://github.com/dotnet/cli
Try out ASP.NET Core sampleshttps://github.com/aspnet/cli-samples
ASP.NET Core deployment in 3 easy steps:1. Restore package dependencies2. Publish your application3. Deploy to a production environment
ASP.NET Core during development.NET Core SDKIncludes .NET Core runtime (CLR) and tools needed to buildInstalled to a common location
Project codeProject.json, source code, static content, dynamic views, configuration
Package dependenciesInstalled centrally in your user profile (using dotnet restore)
ASP.NET Core in production.NET CoreInstalled centrally – just the stuff needed to run apps
Published applicationSingle folder with everything you need to run: built binaries, dependencies, etc.
Publish – prepare your app for deploymentRun dotnet restoreInstall package dependencies
Run dotnet publishCollect app and dependencies into a single self-contained directory structure
Run dotnet <app-assembly>.dll to run your appThe dotnet command from your .NET Core installation should be on the path
Publishing
Self-contained appsApp carries everything with it that it needs to run.NET Core doesn’t need to be pre-installedUseful for constrained environments
Runs like a normal native executableBuilt for a specific platform runtime (Windows, Linux distro, etc.)
Note: self-contained apps are significantly larger and startup may be slow due to JIT time
Self-contained
Publishing for the full .NET FrameworkTarget the full .NET Framework (net4xx)
Runs like a native .exe
All of your existing .NET dependencies work
Target .NET Framework
Microsoft.AspNetCore.Server.Kestrel
Hosting in productionBuilt-in web server (Kestrel)Kestrel is not yet hardened for internet facing trafficRun Kestrel behind a mature reverse proxy IIS, Nginx, Apache, etc
Internet
Kestrel
Proxy Kestrel
Kestrel
Publishing to IISInstall the new ASP.NET Core ModuleNative IIS module that forwards request to your applicationSupports forwarding client certs, Windows auth, IIS sub applications, app offline, logging
Setup module in web.configNew iis-publish tool will handle this for you
Point IIS at your app content rootStatic files will only be served from the web root (wwwroot)
Setup IIS integration for your ASP.NET Core hostwebHostBuilder.UseIISIntegration()
Publishing to IIS
Publishing to AzurePublish directly to Azure from Visual StudioUses WebDeployAutomate deployments using generated scripts
Use Kudu/VSTS to do continuous deploymentKudu deploy script in place for ASP.NET 5 RC1
Publish to Azure
Publishing to Linux with DockerASP.NET Core images on Docker Hubhttps://hub.docker.com/r/microsoft/aspnetcore
Docker for Windows/MacEasily build, assemble and deploy Docker based appshttps://www.docker.com/products/docker
Visual Studio Tools for Docker – PreviewEasily build images and to deploy to a Docker hosthttps://aka.ms/dockertoolsforvs
Deploy to Azure Container Service Create container hosting solutions using Apache Mesos or Docker Swarmhttps://aka.ms/azurecontainerservice
Docker
Public Cloud Other CloudsOn PremisesPrivate cloud
Lifecycle Mgmt
Independent Scaling
Independent Updates
Always On
Availability
ResourceEfficient
Stateless/Stateful
Azure Service Fabric
ASP.NET Core
ASP.NET Core deployment in 3 easy steps:1. Restore package dependencies2. Publish your application3. Deploy to a production environment
ResourcesCode: https://github.com/aspnet/homeDocs: http://docs.asp.netSamples and code: https://github.com/aspnet
Credit: https://www.flickr.com/photos/slightlyblurred/9235803926/
QUESTIONS?
@KenCenerelli