Anthony Chu Contact Me

ASP.NET Core on Azure - Deployment Options

Sunday, May 15, 2016

A couple weeks ago, Jef King, Clint Singer, and I presented at the Vancouver Azure Meetup about the different ways to deploy ASP.NET on Azure. It was a lot of fun!. In this post, I'll summarize our presentations.

There are a few ways to deploy ASP.NET Core on Azure:

  • Virtual Machines and VM Scale Sets
  • Cloud Service Web Roles
  • App Service (Web Apps)
  • Container Service
  • Service Fabric

Hosting ASP.NET Core

ASP.NET Core has a new hosting model that allows it to be hosted in its own process, without a dependency on IIS. This allows it to be hosted almost anywhere, opening doors for running in things like Docker containers.

This doesn't mean we can't use IIS, however. To host it in IIS, we need to use the HttpPlatformHandler module (soon to be replaced by the ASP.NET Core Module). The module serves two purposes: to manage the ASP.NET Core process and to reverse proxy traffic to the ASP.NET Core process. For more information, check out my previous post on this topic.

Virtual Machines

I can't believe that in 2016, there are still people who stand up VMs and load balancers to host web applications. Sure, there are probably still times when an application needs to have fine-grained control over software and configuration on the VMs themselves. But I would hope that this is mainly for legacy applications and is an exception, not the rule.

And if you're still building green-field apps that require messing with the underlying VMs, stop! Read about the 12 Factor App methodology for building apps and start using platforms-as-a-service to host them.

Azure Cloud Service Web Roles

Cloud Services has been around for a while. It's Microsoft's first platform-as-a-service and it worked well. These days, however, there's not much that Cloud Service can do that you can't achieve by using Azure App Service.

Azure App Service (Web Apps)

Azure Web Apps has been my go-to solution for hosting all sorts of web apps. It's a mature, fully-managed platform that offers a lot of power and flexibility. It has so many awesome features that it's difficult to cover in a talk or blog post.

I singled out a couple of features in my presentation. The first was deployment slots. The use of a staging slot gives us Blue-Green Deployments, where deployments can be tested in a staging slot before swapping into production. And production problems can be roll back easily by a simple swap. Slots can also be used for Canary Releases, where new changes are exposed to a small percentage of traffic before everyone sees them.

The second feature I talked about was Application Insights. It has grown into such a mature product in a couple of years. For .NET apps, a simple addition of a NuGet package is all that is needed to gather a whole wealth of information from a running app.

Azure Container Service

Now that ASP.NET Core applications can be baked into Docker images, we need a good place to run them. Azure's new Container Service is a fully managed offering that uses open source technologies like Mesosphere and Docker Swarm. It takes a few minutes to stand up a cluster.

With Windows Server 2016 almost ready, it's no question that ACS will be the first container service to support Windows Containers. Windows Containers will be useful for containerizing .NET 4.6 apps, including web apps that have a dependency on IIS.

For more information on deploying ASP.NET Core applications to Docker Swarm on Azure Container Service, check out my previous post.

Azure Service Fabric

The final option for running ASP.NET Core on Azure is Service Fabric. I was initially skeptical of Service Fabric when it was first announced over a year ago, but I have fallen in love with it lately. Microsoft has been using it internally for over 6 years and many Azure and Microsoft services are built on top of it. It provides a great programming model that makes it super easy to build a bunch of distributed, resilient microservices that store state in the fabric instead of in traditional databases.

Service Fabric for Windows is generally available right now, and the Linux runtime is in private preview. It'll also start supporting Docker containers pretty soon. That can potentially make Service Fabric the one place to run all applications.

Photos

Some photos from the event...

Meetup

Meetup

Meetup

Meetup