Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core website on Azure fails to start with a 502.5 error after upgrade from .NET Core 1.1.1 to .NET Core 1.1.2

I have a .NET Core web application which I deploy as an Azure Web App.

This has been working perfectly until last night when I applied the Visual Studio 2017 upgrade (v15.2).

The .net core version was upgraded from 1.1.1 to 1.1.2. When I deploy to Azure the website fails to start with a 502.5 error.

After investigating I can see .NET Core 1.1.2 is not deployed to the Azure image.

I cannot install the new framework to the web app instance (understandably permission is denied on the Program Files directory). I cannot 'downgrade' through the nuget package manager as it reports the version is 'Blocked by the project'. I cannot see a way to define the version of Microsoft.NETCore.App in the csproj file as it seems this is 'automagically' controlled by the root <Project Sdk="Microsoft.NET.Sdk.Web"> element.

I have tried attempting a self contained deployment (shipping the framework with the web app) but can't get this working either.

Short of waiting for the new version to be deployed to Azure (I can't find any information on their schedule for this) does anyone have any ideas on how to get the web app working again?

Is there any way to force it to run under 1.1.1?

like image 688
Steve Jackson Avatar asked May 11 '17 12:05

Steve Jackson


3 Answers

Update 5/12/2017: we have accelerated the deployment of 1.1.2 and 1.0.5 to App Service and it is now complete. So the workaround below should no longer be needed by anyone.

Original solution

The best workaround is to set this in your .csproj file:

<TargetFramework>netcoreapp1.1.1</TargetFramework>

Instead of it being set to netcoreapp1.1. We will have 1.1.2 deployed to Azure App Service by Tuesday, at which point the workaround won't be necessary.

Note that if if you set it to netcoreapp1.1.1, once 1.1.2 is available it will auto-roll forward to that. So setting it to netcoreapp1.1.1 does not keep you 'stuck' to that version. This is true as long as you use Portable mode (i.e. rely on the framework that's on the OS). If you use standalone and deploy your own framework, then you would be stuck to it (but then you would not have had this issue in the first place and would not have needed to do that!).

like image 147
David Ebbo Avatar answered Oct 20 '22 16:10

David Ebbo


We are having the same issue after the Visual Studio 2017 Update.

A workaround is to edit the web.config for your site in Kudu after it has been deployed.

Add --fx-version 1.1.1 at the start of the arguments value for the aspNetCore entry under system.webServer

e.g <aspNetCore processPath="%LAUNCHER_PATH%" arguments="--fx-version 1.1.1 PATH_TO_DLL" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>

like image 42
Gregg_1987 Avatar answered Oct 20 '22 16:10

Gregg_1987


Until they get around to deploying 1.1.2 to the web app images I managed to fix this by forcing the project to reference Microsoft.NETCore.App 1.1.1

Edit the csproj file:

<ItemGroup> <PackageReference Update="Microsoft.NETCore.App" Version="1.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" /> <PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" /> ... etc

like image 21
Steve Jackson Avatar answered Oct 20 '22 14:10

Steve Jackson