ASP.NET Core 3.1 WebApplication error running publish: Could not load file or assembly

0

I'm having problems trying to run my API ASP.NET Core 3.1 WebApplication in a hosted server, I've searched quite a bit online without luck.

Context:

I'm generating a no-self-contained publish (tried both centos-x64 and linux-x64) and running it with "$ dotnet MyApp.dll" (also tried "$ ./MyApp"). SDKs and runtimes installed on server:

[santi@host ~]$ dotnet --list-sdks
3.1.403 [/usr/share/dotnet/sdk]
[santi@host ~]$ dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Problem:

I've run the published app on two different environmets with CentOS 7 without problem. But when I try to run it on the hosted server (also CentOS 7 but with WHM Cpanel) I get this error:

[santi@host test]$ dotnet MyApp.dll
Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. An internal error occurred.
 (0x8007054F)
File name: 'Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
   at Microsoft.AspNetCore.Hosting.WebHostBuilderKestrelExtensions.<>c.<UseKestrel>b__0_0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass9_0.<ConfigureServices>b__0(WebHostBuilderContext context, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass10_0.<ConfigureServices>b__0(HostBuilderContext context, IServiceCollection builder)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at MyApp.Program.Main(String[] args)


Aborted (core dumped)

Any ideas of what could be the problem? all the environments have the same sdks and runtimes, only big difference I can think of is that the hosted server has Cpanel WHM.

c#
asp.net
.net
asp.net-core
.net-core
asked on Stack Overflow Oct 23, 2020 by santib

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0