Last week I wrote: Step by step: Running ASP.NET Core on Raspberry Pi and didn’t have the time to write about running the application on startup.
After browsing for a while I found this great post: Windows IoT Core: Running a PowerShell Script on Startup which showed me the way!
As a prerequisite read and run the sample provided here: Step by step: Running ASP.NET Core on Raspberry Pi
1. Create startup.ps1
Create startup.ps1 with the following contents
Set-Location C:\publish\ .\aspnet.on.rpi.exe
2. Create startup.bat
Create startup.bat with the following contents
powershell -command "C:\startup.ps1"
3. Copy the files to your Raspberry
Connect to Raspberry using powershell, start the ftp server
Enter-PSSession -ComputerName <Raspberry IP> -Credential <Raspberry IP>\Administrator start C:\Windows\System32\ftpd.exe
Open the File Explorer ftp://
4. Schedule the command to run on Startup
Connect to Raspberry using powershell and run
Enter-PSSession -ComputerName <Raspberry IP> -Credential <Raspberry IP>\Administrator schtasks /create /tn "Startup Web" /tr c:\Startup.bat /sc onstart /ru SYSTEM
5. Restart and verify
Restart your Raspberry and after a bit your ASP.NET Core app should be up and running.
Hope it helps!