Reputation: 2880
I have built and published an ASP.NET Core application within Visual Studio 2017 targeting ASP.NET Core 2.2.8 Runtime. When I deploy (xcopy) to RedHat and try to run in Kestrel I get the following error:
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Microsoft.AspNetCore.Server.Kestrel.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The module was expected to contain an assembly manifest.
This is what I have in my .csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<Platforms>x64</Platforms>
<MicrosoftNETPlatformLibrary>Microsoft.NETCore.App</MicrosoftNETPlatformLibrary>
</PropertyGroup>
<ItemGroup>
<Content Update="appsettings.json;web.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.8" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.2.8" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.2.8"/>
</ItemGroup>
</Project>
Upvotes: 0
Views: 280
Reputation: 2880
I discovered in the RedHat documentation that RedHat doesn't provide the ASP.NET Core 2.2 Hosting Bundle. Instead, RedHat recommends executing a Self-Contained build and copying all of the files (about 400) to your application folder. RedHat resolves this with 3.0 by including the Hosting Bundle in its .NET Core RPM.
The ASP.NET Core Shared Framework is not available on RHEL. Deployed ASP.NET Core applications must include the ASP.NET Core packages.
https://access.redhat.com/documentation/en-us/net_core/2.2/html/release_notes_for_rpms/known_issues
Upvotes: 1