如何在 Windows 10 IoT Core 中将 Asp.Net 核心应用设置为服务?
How to set Asp.Net Core app as a service in Windows 10 IoT Core?
我已在 Win IoT Core 上成功部署 ASP.NET Core 2.0 (MVC)(在 Rasp Pi 3 上部署 运行)。设备正在侦听 192.168.0.14:80。
我通过 PowerShell(从连接到设备的主机)激活应用程序,如下所示。
问题是,如果我关闭 PowerShell window,服务器将停止侦听。
问题
如何将 Web 应用程序作为服务激活,即使在重新启动设备后也始终 运行?
您应该尝试连接到 RPi:
Enter-PSSession -ComputerName <Raspberry IP> -Credential <Raspberry IP>\Administrator
然后安排任务:
schtasks /create /tn "Startup Web" /tr c:\Startup.bat /sc onstart /ru SYSTEM
其中 startup.bat 执行 powershell 脚本,类似于:
Set-Location C:\publish\ .\aspnet.on.rpi.exe
查看此 post 以获得完整示例:https://carlos.mendible.com/2017/03/26/raspberry-pi-run-aspnet-core-on-startup/
我已在 Win IoT Core 上成功部署 ASP.NET Core 2.0 (MVC)(在 Rasp Pi 3 上部署 运行)。设备正在侦听 192.168.0.14:80。
我通过 PowerShell(从连接到设备的主机)激活应用程序,如下所示。
问题是,如果我关闭 PowerShell window,服务器将停止侦听。
问题
如何将 Web 应用程序作为服务激活,即使在重新启动设备后也始终 运行?
您应该尝试连接到 RPi:
Enter-PSSession -ComputerName <Raspberry IP> -Credential <Raspberry IP>\Administrator
然后安排任务:
schtasks /create /tn "Startup Web" /tr c:\Startup.bat /sc onstart /ru SYSTEM
其中 startup.bat 执行 powershell 脚本,类似于:
Set-Location C:\publish\ .\aspnet.on.rpi.exe
查看此 post 以获得完整示例:https://carlos.mendible.com/2017/03/26/raspberry-pi-run-aspnet-core-on-startup/