Hi

how to Run Uvicorn as a Windows Service or task schduler

 Use NSSM (Non-Sucking Service Manager).


istall service:

nssm install NLP3AP

Configure:

Application Path

C:\inetpub\wwwroot\nlp3\nlp3-env\Scripts\python.exe

Arguments

-m uvicorn main:app --host 0.0.0.0 --port 8003

Startup Directory

C:\inetpub\wwwroot\nlp3
  1. Click Install Service
  2. Start service:
net start NLP3API

Now it starts automatically after server reboot.


Using Use Task Scheduler

Create a task:

  • Trigger: At Startup
  • Program:
C:\inetpub\wwwroot\project\project
-env\Scripts\python.exe
  • Arguments:
-m uvicorn main:app --host 0.0.0.0 --port 8000
  • Start in:
C:\inetpub\wwwroot\project

This starts the API automatically when Windows starts.

Previous
Next Post »