Host ASP.NET Core on Azure App Service

Azure App Service is a Microsoft cloud computing platform service for hosting web apps, including ASP.NET Core.

Useful resources

The Azure Web Apps Documentation is the home for Azure Apps documentation, tutorials, samples, how-to guides, and other resources. Two notable tutorials that pertain to hosting ASP.NET Core apps are:

Quickstart: Create an ASP.NET Core web app in Azure
Use Visual Studio to create and deploy an ASP.NET Core web app to Azure App Service on Windows.

Quickstart: Create a .NET Core web app in App Service on Linux
Use the command line to create and deploy an ASP.NET Core web app to Azure App Service on Linux.

The following articles are available in ASP.NET Core documentation:

Publish to Azure with Visual Studio
Learn how to publish an ASP.NET Core app to Azure App Service using Visual Studio.

Publish to Azure with CLI tools
Learn how to publish an ASP.NET Core app to Azure App Service using the Git command-line client.

Continuous deployment to Azure with Visual Studio and Git
Learn how to create an ASP.NET Core web app using Visual Studio and deploy it to Azure App Service using Git for continuous deployment.

Continuous deployment to Azure with VSTS
Set up a CI build for an ASP.NET Core app, then create a continuous deployment release to Azure App Service.

Azure Web App sandbox
Discover Azure App Service runtime execution limitations enforced by the Azure Apps platform.

Application configuration

In ASP.NET Core 2.0 or later, the following NuGet packages provide automatic logging features for apps deployed to Azure App Service:

If targeting .NET Core and referencing the Microsoft.AspNetCore.All metapackage, the packages are already included. The packages are absent from the newer Microsoft.AspNetCore.App metapackage. If targeting .NET Framework or referencing the Microsoft.AspNetCore.App metapackage, reference the individual logging packages.

Proxy server and load balancer scenarios

The IIS Integration Middleware, which configures Forwarded Headers Middleware, and the ASP.NET Core Module are configured to forward the scheme (HTTP/HTTPS) and the remote IP address where the request originated. Additional configuration might be required for apps hosted behind additional proxy servers and load balancers. For more information, see Configure ASP.NET Core to work with proxy servers and load balancers.

Monitoring and logging

For monitoring, logging, and troubleshooting information, see the following articles:

How to: Monitor Apps in Azure App Service
Learn how to review quotas and metrics for apps and App Service plans.

Enable diagnostics logging for web apps in Azure App Service
Discover how to enable and access diagnostic logging for HTTP status codes, failed requests, and web server activity.

Introduction to Error Handling in ASP.NET Core
Understand common approaches to handling errors in ASP.NET Core apps.

Troubleshoot ASP.NET Core on Azure App Service
Learn how to diagnose issues with Azure App Service deployments with ASP.NET Core apps.

Common errors reference for Azure App Service and IIS with ASP.NET Core
See the common deployment configuration errors for apps hosted by Azure App Service/IIS with troubleshooting advice.

Data Protection key ring and deployment slots

Data Protection keys are persisted to the %HOME%\ASP.NET\DataProtection-Keys folder. This folder is backed by network storage and is synchronized across all machines hosting the app. Keys aren't protected at rest. This folder supplies the key ring to all instances of an app in a single deployment slot. Separate deployment slots, such as Staging and Production, don't share a key ring.

When swapping between deployment slots, any system using data protection won't be able to decrypt stored data using the key ring inside the previous slot. ASP.NET Cookie Middleware uses data protection to protect its cookies. This leads to users being signed out of an app that uses the standard ASP.NET Cookie Middleware. For a slot-independent key ring solution, use an external key ring provider, such as:

  • Azure Blob Storage
  • Azure Key Vault
  • SQL store
  • Redis cache

For more information, see Key storage providers.

Deploy ASP.NET Core preview release to Azure App Service

ASP.NET Core preview apps can be deployed to Azure App Service with the following approaches:

If a problem occurs using the preview site extension, open an issue on GitHub.

Install the preview site extension

  1. From the Azure portal, navigate to the App Service blade.

  2. Select the web app.

  3. Enter "ex" in the search box or scroll down the list of management panes to DEVELOPMENT TOOLS.

  4. Select DEVELOPMENT TOOLS > Extensions.

  5. Select Add.

    Azure App blade with preceding steps

  6. Select ASP.NET Core Extensions.

  7. Select OK to accept the legal terms.

  8. Select OK to install the extension.

When the add operations complete, the latest .NET Core preview is installed. Verify the installation by running dotnet --info in the console. From the App Service blade:

  1. Enter "con" in the search box or scroll down the list of management panes to DEVELOPMENT TOOLS.
  2. Select DEVELOPMENT TOOLS > Console.
  3. Enter dotnet --info in the console.

If version 2.1.300-preview1-008174 is the latest preview release, the following output is obtained by running dotnet --info at the command prompt:

Azure App blade with preceding steps

The version of ASP.NET Core shown in the preceding image, 2.1.300-preview1-008174, is an example. The latest preview version of ASP.NET Core at the time the site extension is configured appears when you execute dotnet --info.

The dotnet --info displays the the path to the site extension where the Preview has been installed. It shows the app is running from the site extension instead of from the default ProgramFiles location. If you see ProgramFiles, restart the site and run dotnet --info.

Use the preview site extension with an ARM template

If an ARM template is used to create and deploy apps, the siteextensions resource type can be used to add the site extension to a web app. For example:

    "type": "siteextensions",
    "name": "AspNetCoreRuntime",
    "apiVersion": "2015-04-01",
    "location": "[resourceGroup().location]",
    "properties": {
        "version": "[parameters('aspnetcoreVersion')]"
    "dependsOn": [
        "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"

Use Docker with Web Apps for containers

The Docker Hub contains the latest preview Docker images. The images can be used as a base image. Use the image and deploy to Web Apps for Containers normally.

Additional resources

Azure App Service on Windows Server uses Internet Information Services (IIS). The following topics pertain to the underlying IIS technology: