You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The very concept of "always running" or not is only applicable when your application is hosted by IIS. It has the ability to stop/unload applications after a period of inactivity, and load/start it again when request comes.
When hosting it as a systemd service on Linux, there's no such thing. All services (unless they're socket-activated templates on per-connection basis, which it is not your case) are always running. Systemd starts the service process and monitors its status, but otherwise doesn't affect it in any way (unless it is explicitly told to with systemctl command or similar).
So, with your app stopping and restarting, I can imagine a few possible scenarios:
Something (e.g. cron schedule, or host events if your machine is running in a cloud) or someone (admin) is restarting your server/service periodically. This is unlikely, but still a possibility.
Your application crashes hard (memory corruption in native modules or runtime itself, stack overflow, or some other thing that can't be handled by .net managed exception handlers), and is restarted by systemd because of restart policy.
Your application hits some limit (virtual memory size, number of open file handles, amount of data written etc.) set on your system, and is killed by the kernel. Then it is restarted by systemd.
In any case, there should be traces in the service log. If the reason is system limits, those can be altered globally or set in service config for a specific service.
We have a background job that is long running and cannot be idempotent. When redhat restarts our hangfire .net core app, we lose hours of progress.
We are using following configuration.
`
[Unit]
Description=ABC
[Service]
WorkingDirectory=/var/www/html/ABC
ExecStart=/usr/bin/dotnet /var/www/html/ABC/XYZ.DLL
Restart=always
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
`
The text was updated successfully, but these errors were encountered: