The other day I wrote a small application to collect images from events. As I work in my day job with C# and entity framework, I gave it a shot and used it for this tool.
The development was straight forward, as I knew it, the deployment was a little different.
I never deployed a dotnet application to a linux machine, but it realy just was the installation of the dotnet runtime, and nginx.

To let the dotnet application run in the background, you add a service in /etc/systemd/system/YOURSERVICE.service:

[Unit]
Description=This service runs a dotnet application natively on linux.
[Service]
WorkingDirectory=/YOUR/WORKING/DIRECTORY
ExecStart=/YOUR/WORKING/DIRECTORY/YOUR/EXE
Restart=always
#Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=APPLICATIONNAME
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
#If you need to run multiple services on different ports set
#the ports environment variable here:
#Environment=ASPNETCORE_URLS=http://localhost:6000
[Install]
WantedBy=multi-user.target

Here is what the nginx config looks like before certbot runs:

The config looks like this:

server {
listen 80;
server_name WEBSITENAME;
client_max_body_size 500M;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

Certbot just needs the website name and goes to work.

sudo certbot --nginx -d WEBSITENAME

It replaces the listing port and creates a redirect from http to https and links your certificates.

Restart nginx and the application should come to live.