I am attempting to use .NET 8 on Ubuntu to host a .NET Core application. When I run
dotnet --version
on the server I get 8.0.107
on the development Windows Machine it is 8.0.400-preview.0.24324.5
The app is built using a task in Azure Devops as follows, then scp-ed to the server
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c Release --runtime linux-x64 -o amnathrig-dev'
zipAfterPublish: false
modifyOutputPath: false
And configured to run using a Kestrel Service configured as follows
[Unit]
Description=Amnathrig Dev
[Service]
WorkingDirectory=/var/www/amnathrig-dev
ExecStart=/usr/bin/dotnet /var/www/amnathrig-dev/amnathrig.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=amnathrig-dev
User=ubuntu
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment="ASPNETCORE_URLS=http://localhost:3142"
[Install]
WantedBy=multi-user.target
The app crashes with a core dump according to the service status
and when I run
sudo systemctl status kestrel-amnathrig-dev.service
I noticed an exception was thrown with the following text
Hosting failed to start
System.IO.IOException: Failed to bind to address http://localhost:3142.
---> System.AggregateException: One or more errors occurred. (The type initializer for 'System.Net.SocketAddress' threw an exception.) (The type initialize>
---> System.TypeInitializationException: The type initializer for 'System.Net.SocketAddress' threw an exception.
---> System.TypeInitializationException: The type initializer for 'System.Net.SocketAddressPal' threw an exception.
---> System.EntryPointNotFoundException: Unable to find an entry point named 'SystemNative_GetSocketAddressSizes' in shared library 'libSystem.Native'.
Both ChatGPT and Github Copilot indicate a potential conflict with the runtime versions.
I expected a the app to run as it does locally with version 8, and remotely on a Oracle Linux server with version 6