Jeremy Caney
Jeremy Caney

Reputation: 7624

Deploy ASP.NET Core 6 app to existing Azure App Service?

Based on today's announcement of the ASP.NET Core 6 release, it is my understanding that .NET 6 will be immediately available ("day 0 support") on Azure App Services via Early Access:

We are happy to announce that App Service is rolling out day 0 support for .NET 6.0 applications across all public regions and scenarios on both Windows and Linux App Service plans.

After upgrading my ASP.NET Core application to ASP.NET Core 6, configuring my Azure App Service to use .NET 6, and publishing my application to my existing Azure App Service, however, I get an HTTP Error 500.31 with the specific message:

The framework 'Microsoft.NETCore.App', version '6.0.0' (x64) was not found.

Notably, the only .NET 6 runtime it lists as available is RC2 (6.0.0-rc.2.21480.5), not today's release version.

Upgrade Steps

To facilitate this, I performed the following steps:

Error Message

When accessing my Azure App Service site with detailed errors enabled, however, I receive the following error:

HTTP Error 500.31 - ANCM Failed to Find Native Dependencies

Common solutions to this issue:

The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.

Specific error detected by ANCM:

It was not possible to find any compatible framework version 
The framework 'Microsoft.NETCore.App', version '6.0.0' (x64) was not found.

The following frameworks were found: 
2.2.14 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App] 
3.0.3 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App] 
3.1.15 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App] 
3.1.18 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App] 
5.0.7 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App] 
5.0.9 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App] 
6.0.0-rc.2.21480.5 at [D:\Program Files\dotnet\shared\Microsoft.NETCore.App] 

You can resolve the problem by installing the specified framework and/or SDK. 

The specified framework can be found at:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=win10-x64

Additional Information

Mixed Messages

While the Azure App Service update cited above suggests that there will be "day 0 support", the ASP.NET Core 6 announcement is less committed:

At the time of this post, .NET 6 is being actively deployed to the worldwide network of servers and configured to build and run .NET 6 apps… which should conclude by the end of this week

I would assume that the Azure update on GitHub would be the most authoritative source, but perhaps there are problems with the rollout that haven't yet been acknowledged by the Azure team?

Related Topics

I previously posted two questions related to publishing previous early releases of ASP.NET Core web applications to Azure App Services, and have followed the resolutions relevant to those posts, to no avail:

Question

How can I deploy a release version of an ASP.NET Core 6 app to an Azure App Service using the Early Access program? Is this even ready yet (as per the Azure App Service announcement)? Or do we need to wait until the end of week (as per the ASP.NET Core 6 announcement)?

Ideally, I’d like to take advantage of Early Access without either distributing the runtime with my application (as a self-contained distribution) or installing the runtime via an extension. Obviously, those remain options, but the premise of Early Access is that they shouldn’t be necessary.

Upvotes: 4

Views: 9942

Answers (4)

Newteq Developer
Newteq Developer

Reputation: 2657

I ran into this problem with deploying with Azure DevOps and was completely confused. So I'm posting this to help anyone who is experiencing the same problem upgrading to .NET 6 and using Azure DevOps to deploy.

It was actually quite a small change that was needed.

In the pipeline for the release, make sure that the Runtime Stack selected is DOTNETCORE 6 (see image below)

enter image description here

Upvotes: 3

Jeremy Caney
Jeremy Caney

Reputation: 7624

Good news. This appears to have been a temporary lag between the Azure App Service team's "day 0" announcement and actual availability. As of this post, the .NET 6 runtime is now available via Early Access in, at minimum, the South Central US region—and, presumably, others as well (unconfirmed). Worst case, based on the ASP.NET Core 6 announcement, this should be globally available by the end of the week.

Migration Steps

To reiterate from the original post, to migrate you need to perform the following steps:

  • Project: Migrate your app from e.g., ASP.NET 5 to ASP.NET 6; notably, in the project file (csproj):
    • Update the <TargetFramework /> to target the net6.0
    • Update all Microsoft.AspNetCore.* NuGet packages to 6.0.0
  • Publishing profile (pubxml): Update the <TargetFramework /> to target the net6.0
  • Azure App Service Configuration: Updated the .NET Version to ".NET 6 (Early Access)"

Additional Information

You should not need to do any of the following:

  • Restart your Azure App Service
  • Publish your web application using the Self-contained deployment mode
  • Install the .NET runtime via Azure App Service Extensions
  • Configure the AspNetCoreModule(V2) (as was required for ASP.NET Core 3)

Workarounds

If Early Access isn't yet available in your region and you don't want to wait until the end of the week, there are two workarounds available to you, as suggested elsewhere on this thread:

All said, Microsoft can at least claim this was available on "day 1" and take advantage of the ambiguity in indexing.

Upvotes: 3

Jason Pan
Jason Pan

Reputation: 21949

  1. You should change .NET version to .Net 6(Early Access).

  2. And you also need to install extension in scm site, url like https://your_app_name.scm.azurewebsites.net. Search ASP.NET Core 6.0, and install them.

    enter image description here

  3. Then you can restart your webapp to check.

Upvotes: 2

EricImhauser
EricImhauser

Reputation: 791

I have successfully deployed to an App Service using the Self-Contained Deployment Mode. All I did is change the TargetFramework to net6.0 in the csproj file and update the nuget all packages to 6.0.0.

Upvotes: 0

Related Questions