1.6 KiB
1.6 KiB
Updating Your Deployed DLLs
When you publish a new version of your .NET Web API DLL or rename the DLL file, you need to update your systemd service file accordingly to ensure the service runs the correct binary.
Which Files to Edit
- Systemd Service File
- Path:
/etc/systemd/system/mydotnetapi.service - Purpose: Defines how your API service is started and managed on Debian.
- Key section to update:
ExecStart
Example
Suppose your new DLL filename is NewApi.dll instead of Taekwondo.WebApi.dll. Update the service file by changing the ExecStart line:
[Unit]
Description=My .NET Web API
After=network.target
[Service]
WorkingDirectory=/opt/api
ExecStart=/usr/bin/dotnet /opt/api/NewApi.dll
Restart=always
RestartSec=10
SyslogIdentifier=dotnet-api
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
Then reload systemd and restart the service to apply changes:
sudo systemctl daemon-reload
sudo systemctl restart mydotnetapi
sudo systemctl status mydotnetapi
- Application Configuration Files (Optional)
- Example:
/opt/api/appsettings.json - Purpose: Contains connection strings and other runtime settings.
- Edit if your new DLL version requires different settings.
Summary
- Always update the
ExecStartpath in the systemd service file to point to your new DLL file. - Reload and restart the service after modification.
- Update any runtime configuration files if needed.
This process ensures your deployed API runs the correct version after updating DLLs, guaranteeing smooth service operation on your Debian LXC environment.