Running old versions of .NET code in Azure App Service

Case

You have an older than current (but supported) version of ASP.NET application code and you need to deploy your .NET application to the Azure App Service. For example, you may have ASP.NET apps running .NET version 4.6.1 and you need to deploy these apps to Azure App Service. The currently supported options for ASP.NET code are .NET 3.5 and NET 4.8.

Solution

First you need to deploy the latest .NET runtime (https://dotnet.microsoft.com/download/dotnet-framework/net48) on your IIS server where your apps are hosted. After you install the latest (in this case ASP.NET 4.8 version), you need just to change the target framework in Visual Studio and the <httpRuntime targetFramework=”4.6.1″/> in the web.config to <httpRuntime targetFramework=”4.8″/>.

Visual Studio compatibility settings

Remember that .NET code is backward compatible. Backward compatibility means that an app that was developed for a particular version of a platform will run on later versions of that platform. .NET Framework tries to maximize backward compatibility: Source code written for one version of .NET Framework should compile on later versions of .NET Framework, and binaries that run on one version of .NET Framework should behave identically on later versions of .NET Framework.

You should review the following topics for application compatibility issues that may affect your app:

https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/runtime/4.6.1-4.8

Upgrading the Web apps to 4.8 it is not mandatory to the Azure App service. Even if you choose version 4.8 in the Azure portal, since this is the only choice that is available in the drop down, the platform is still able to run the Application using 4.6.1. The 4.6.1 version is already installed on the Azure app service.

Microsoft encourages you to upgrade/retarget your apps to latest .NET version (currently 4.8) as it contains the many enhancements and the end of support of 4.6.1 will be 22/4/2022.

Sources

https://docs.microsoft.com/en-us/answers/questions/558585/does-azure-app-service-support-aspnet-461-version.html

.NET Framework 4.5.2, 4.6, 4.6.1 will reach End of Support on April 26, 2022 (microsoft.com)

https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/version-compatibility

https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/retargeting/4.6.1-4.8

Was this article helpful?

Related Articles