I've updated my application from ASP.NET Core v1.1 to ASP.NET Core 2.0.
Everything works fine on my dev machine. But when I'm deploying to Azure I get "HTTP Error 502.5 - Process Failure"
as a response.
I've activated logging in web.config:
<aspNetCore processPath=".\PublicWeb2.Web.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
The log says:
Failed to initialize CoreCLR, HRESULT: 0x80004005
I get the same error if I run dotnet mysite.dll
from the command prompt in Kudo.
The event log in Azure gives the following error:
Application 'MACHINE/WEBROOT/APPHOST/XXXXX' with physical root 'D:\home\site\wwwroot\' failed to start process with commandline 'D:\home\site\wwwroot\XXX ', ErrorCode = '0x80004005 : 80008089.
Relevant Azure settings:
My complete csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<UserSecretsId>XXXXXXXXXXX</UserSecretsId>
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
<WebProject_DirectoryAccessLevelKey>1</WebProject_DirectoryAccessLevelKey>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MarkdownWeb" Version="1.3.4" />
<PackageReference Include="MarkdownWeb.Git" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\XXX\XXX.csproj" />
</ItemGroup>
</Project>
Dotnet version installed on the cloud service:
D:\home\site\wwwroot>dotnet --info
.NET Command Line Tools (2.0.0)
Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9
Runtime Environment:
OS Name: Windows
OS Version: 6.2.9200
OS Platform: Windows
RID: win8-x86
Base Path: D:\Program Files (x86)\dotnet\sdk\2.0.0\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
What I've done (from reading other SO questions):
- Added
win7-x86
as the first runtime identifier in my csproj - Selected win7-x86 in the azure deployment settings
- Manually deleted all old files from wwwroot using the console in Kudo (and then deployed again)
- Tried with
COREHOST_TRACE=1
activated, but then the console hangs in kudo (and piping to a log doesnt work, i.e.dotnet myapp.dll > mylog.txt
)
I have no clue about what to do next.
Finally got it working.
1. Remove runtime identifiers in your project file
In the csproj file of the webproject I removed the
<RuntimeIdentifiers>
element (it's<RuntimeIdentifier>
if you've specified a single runtime).2. Remove
<RuntimeIdentifier>
in the publish profile.The pubxml can be found in solution explorer under
Remove the following line (which got your runtime specified)
Save the file and close it.
Next time you run the publish command, it should say "portable" under the
Settings
option:That worked for me.
Thus my guess is that the real solution is:
RuntimeIdentifier
is specified in the publish profileRuntimeIdentifier
is specified in the csproj file