HTTP Error 502.5 - Process Failure asp.net api using azure

1

I got a ASP.Net application that runs fine locally. when i deploy from VS 2017 to azure its deploys fine but when i get to the address the 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. The application process started but failed to listen on the configured port.

Troubleshooting steps:

Check the system event log for error messages. Enable logging the application process’ stdout messages. Attach a debugger to the application process and inspect.

This problem arrived once i added this in web.config:

  <compilation debug="true" targetFramework="4.5">
<assemblies>
  <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</assemblies>

to fix another problem. It didnt help but i accidently left this in my code. i deployed once to azure having this piece of code in my web.config. then this problem arrived. and even when i removed this piece of code the error still keeps appearing. it has run fine for serveral days.

when i check my file logs it says:

>Application 'MACHINE/WEBROOT/APPHOST/LIBRARYRESTAPI' with physical root 'D:\home\site\wwwroot\' failed to start process with commandline '"dotnet" .\Library.API.dll', ErrorCode = '0x80004005 : e0434352.

the rest of my web.config looks like this:

<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
  </system.webServer>
</configuration>

my startup.cs looks like this:

public class Program
{
    public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup<Startup>()
            .Build();

        host.Run();
    }
}


the PROJECT.csproj looks like this:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.0</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <AssemblyName>Library.API</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>Library.API</PackageId>
    <RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
    <PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <Prefer32Bit>True</Prefer32Bit>
    <DocumentationFile>bin\Release\netcoreapp1.0\Library.API.xml</DocumentationFile>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.3" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.0.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.0.2" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.0.3" />
    <PackageReference Include="System.Net.Http" Version="4.3.2" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="System.Web">
      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll</HintPath>
    </Reference>
    <Reference Include="System.Web.Extensions">
      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.Extensions.dll</HintPath>
    </Reference>
  </ItemGroup>

</Project>
azure
asked on Stack Overflow May 12, 2017 by louisschrauwen • edited May 12, 2017 by louisschrauwen

3 Answers

2

I just encountered a similar issue.

I updated my .csproj to target 1.1.1 and that fixed the issue when uploading to Azure.

<PropertyGroup>
    <TargetFramework>netcoreapp1.1.1</TargetFramework>
....
</PropertyGroup>

I'm not sure what happened to cause this issue. I have completed several uploads to Azure this week. There was an update to VS 2017 yesterday which might be the cause.

answered on Stack Overflow May 12, 2017 by Eilimint
0

My solution was that i recreated my api in an new asp.net project.

I just copied the code and it started working again.

answered on Stack Overflow May 16, 2017 by louisschrauwen
0

I was running multiple applications in different virtual directories but inside a single azure app service. The application I added had different versions of dependencies inside than the existing one which caused this error. I made my dependencies to match and now they're both working.

answered on Stack Overflow Nov 22, 2019 by sirdank

User contributions licensed under CC BY-SA 3.0