gpt4 book ai didi

azure - MSDeploy 到 Azure Web 应用程序 : Could not connect to the remote computer using the specified process ("Web Management Service")

转载 作者:行者123 更新时间:2023-12-01 07:48:48 25 4
gpt4 key购买 nike

我们使用以下脚本在 VSO/VSTS Build (vNext) 中使用 MSBuild MSDeploy 发布到我们的 Azure Web App。这效果很好。

但是,当将 Azure Web App 分配给自定义域(通过 Azure 门户)时,发布失败。

MSDeploy 上的 VSTS 生成错误:

Publishing with publish method [MSDeploy] Executing command ["C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:IisApp='C:\a\8b0700fff\MrProjectMain\Api\wwwroot' -dest:IisApp='myproject-prod-webapp',ComputerName='https://myproject-prod-webapp.azurewebsites.net/msdeploy.axd',UserName='$myproject-prod-webapp',Password='{PASSWORD-REMOVED-FROM-LOG}',IncludeAcls='False',AuthType='Basic' -verb:sync -enableLink:contentLibExtension -retryAttempts:2 -disablerule:BackupRule]
[error]Error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
[error]More Information: Could not connect to the remote computer ("myproject-prod-webapp.azurewebsites.net") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC. [error]Error: The remote server returned an error: (403) Forbidden.
[error]Error count: 1.

Azure 门户自定义域设置:

Azure Portal Custom domain

发布脚本:

param($websiteName, $packOutput)

$website = Get-AzureWebsite -Name $websiteName
$msdeployurl = $website.EnabledHostNames[1]

$publishProperties = @{'WebPublishMethod'='MSDeploy';
'MSDeployServiceUrl'=$msdeployurl;
'DeployIisAppPath'=$website.Name;
'Username'=$website.PublishingUsername;
'Password'=$website.PublishingPassword;
'SkipExtraFilesOnServer'='False';
'AllowUntrustedCertificate'='True'}

Write-Output "Publishing web app..."
$publishScript = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\default-publish.ps1"
. $publishScript -publishProperties $publishProperties -packOutput $packOutput

最佳答案

问题在这里:

$msdeployurl = $website.EnabledHostNames[1]

默认情况下,MSDeploy SCM URL 是 EnabledHostNames 数组中的第二个。所以它默认工作。但是,一旦您对网络应用程序进行了一些更改,它可能就无法工作。根据您提供的日志,MSDeploy 正在尝试连接到“https://myproject-prod-webapp.azurewebsites.net/msdeploy.axd ”,这不是 SCM URL。 SCM URL 应如下所示:“https://myproject-prod-webapp.scm.azurewebsites.net/msdeploy.axd”。所以你现在需要检查正确的 scm URL 数组号是多少。您可以在 PowerShell 脚本中添加如下代码来查看哪个是 scm URL,然后相应地更新脚本。

Write-Output $website.EnabledHostNames[0]
Write-Output $website.EnabledHostNames[1]
Write-Output $website.EnabledHostNames[2]
...

您还可以引用this article更新您的脚本以自动获取正确的 SCM url。

关于azure - MSDeploy 到 Azure Web 应用程序 : Could not connect to the remote computer using the specified process ("Web Management Service"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34435909/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com