Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.net-core-2.0 azure app service 502.5 error

Tags:

Getting a 502.5 error after CI deployment to azure app service.

When running dotnet {myproject}.dll on the debug console this is the error I get:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors) at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at My.IOEducation.Api.Program.Main(String[] args) in D:\home\site\repository\My.IOEducation.Api\Program.cs:line 11

Running dotnet --version returns 2.0.0

Anyone else run into this yet and any suggestions on how to resolve?

UPDATE: Here is the contents of the project file.

<Project Sdk="Microsoft.NET.Sdk.Web">   <PropertyGroup>     <TargetFramework>netcoreapp2.0</TargetFramework>   </PropertyGroup>   <ItemGroup>     <Folder Include="Models\Report\" />     <Folder Include="wwwroot\" />     <Folder Include="DataAccess\ExternalApis\" />     <Folder Include="DataAccess\ExternalApis\Helpers\" />     <Folder Include="Models\Dashboard\" />     <Folder Include="Helpers\" />     <Folder Include="DataAccess\Redis\" />   </ItemGroup>   <ItemGroup>     <PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.0.0" />     <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />     <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />     <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />     <PackageReference Include="PowerBI.NetStandard.Api" Version="1.0.0" />     <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />     <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUi" Version="1.0.0" />     <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="1.0.0" />     <PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="1.0.0" />     <PackageReference Include="Dapper" Version="1.50.2" />     <PackageReference Include="StackExchange.Redis" Version="1.2.6" />     <PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />     <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />   </ItemGroup>   <ItemGroup>     <None Remove="DataAccess\.DS_Store" />     <None Remove=".DS_Store" />   </ItemGroup> </Project> 
like image 976
ktice12 Avatar asked Aug 15 '17 13:08

ktice12


People also ask

What is 502. 5 error?

HTTP Error 502.5 - Process Failure. Common causes of this issue: The application process failed to start. The application process started but then stopped.

How do I troubleshoot Azure App Service?

To access App Service diagnostics, navigate to your App Service web app or App Service Environment in the Azure portal. In the left navigation, click on Diagnose and solve problems.

What is ANCM failed to start?

ANCM failed to start within the provided startup time limit. By default, the timeout is 120 seconds. This error can occur when starting a large number of apps on the same machine. Check for CPU/Memory usage spikes on the server during startup.


1 Answers

I spoke to the aspnet IISIntegration team members and found my solution.

tldr: Empty out your wwwroot folder on kudu.

The issue relates to having old things leftover from previous 1.x deployments

Step 1:

Navigate to the Kudu Console (https://{yourapp}.scm.azurewebsites.net/)

Step 2:

Navigate to file structure

Step 3:

Delete wwwroot folder

(Note: navigate into the "site" directory)

(Note: there is a wwwroot folder within this wwwroot. You should delete the one that is in the "site" directory)

Step 4:

Add a new empty folder called wwwroot where you just deleted the previous one (within "site" directory)

(Note: my deployment failed when I didn't have the empty wwwroot folder in there)

Step 5: Redeploy your app and hopefully it works. Good luck

like image 130
Charl Avatar answered Oct 25 '22 23:10

Charl