1 回答

TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超5個贊
嘗試dotnet-publish-ssh。
它的工作方式與 類似dotnet publish
,但允許您通過 SSH 將應(yīng)用程序復(fù)制到目標(biāo) Linux 計(jì)算機(jī)。
這是我的配置:
dotnet?publish-ssh?--ssh-host?<host>?--ssh-user?<user>?--ssh-password?<pass>?--ssh-path?/var/<myapp>?--configuration?Release?--framework?netcoreapp3.1?--runtime?linux-x64?--self-contained?false?/p:PublishSingleFile=true
要重新啟動應(yīng)用程序,您可以嘗試使用 Posh-SSH 模塊的 PowerShell:
Import-Module Posh-SSH
$serverAddress = "host addr"
$user = "user"
$pass = ConvertTo-SecureString "pass" -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential ($user, $pass)
$launchFolder = "/var/<myapp>"
$sshSession = New-SSHSession -ComputerName $serverAddress -Credential $creds -ErrorAction Stop
Invoke-SSHCommand -SSHSession $sshSession -Command "<your restart command>"
Remove-SSHSession -SSHSession $sshSession
- 1 回答
- 0 關(guān)注
- 219 瀏覽
添加回答
舉報(bào)