Microsoft often releases updates to .NET Core, usually as security patches. This morning, the .NET Core 3.1.5 update was released. However, Azure App Service's own .NET Core runtime will not be updated immediately, and we would usually wait a few weeks before Microsoft roll out the update to Azure. For applications with high security requirements, it is urgent to complete the update before Microsoft patches App Service, how can we do it?
Today I share a little trick that allows Azure App Service to use the latest version of the .NET Core runtime within hours after .NET Core ships an update, without having to wait for Microsoft’s deployment. The example is still my blog site. Before the update, the runtime version was 3.1.4.
Microsoft shipped version 3.1.5 this morning.
Although we may want to recompile and deploy the application for 3.1.5 through SCD, the cost of doing so is too high.
App Service Extensions
In fact, every time Microsoft releases the .NET Core patch, it will also push to the Azure App Service Extensions Marketplace. The runtime installed in Extensions will override the default runtime provided by App Service, so that we can use the new version of .NET Core.
Just go to Extensions in the Web App menu. If you find that .NET Core runtime already exists, you can click into it and select Update. If you have not installed .NET Core runtime, click Add to find and install the latest version.
Choose the runtime corresponding to your website. If you are not sure, you can install both X86 and X64. After the installation is complete, you can see the latest version number in the Extensions list.
The final step is to Restart your website, and you are all good to go.
It is a pity that, based on years of experience, such ideal situations rarely occur. Updating or installing .NET Core runtime from Extensions usually fails with the following issue:
1. Installation indicates success, but refreshing Extensions list still shows old version, or the .NET Core runtime even disappears.
2. Installation fails like this:
If you meet these issues, try to install the .NET Core runtime again and again, wait for 2-3 minutes after each try, it will usually success after 4-5 tries.