Registering ASP.NET Core Site as Windows Service
This post explains how to register an ASP.NET Core website as a Windows service via NSSM.
To register an ASP.NET Core website as a Windows service, you can use NSSM (Non-Sucking Service Manager).
Here are the general steps:
- Download NSSM and extract the files to a folder on your computer.
- Open a command prompt as an administrator and navigate to the folder containing the NSSM executable.
- Run the following command to create a new service:
nssm install <service name>
- In the NSSM Service Installer window, click the "Browse" button next to the "Path" field and select the executable for your ASP.NET Core web app.
- In the "Startup directory" field, enter the directory containing your ASP.NET Core web app's executable.
- In the "Arguments" field, enter the command-line arguments for your ASP.NET Core web app (e.g.
- Click "Install service" to create the new service.
After the service is installed, you can start and stop it using the Services app in Windows. Note that you may need to adjust the security settings for the service to allow it to interact with the desktop or access network resources, depending on your app's requirements.