导致此错误的原因:错误\目标\不可访问,Microsoft.Web.Deployment.PowerShell.SyncPackage

导致此错误的原因:错误\目标\不可访问,Microsoft.Web.Deployment.PowerShell.SyncPackage,powershell,iis-7,msdeploy,webdeploy,Powershell,Iis 7,Msdeploy,Webdeploy,使用Powershell脚本化web部署作业,我在某些主机上收到此错误: C:\> Get-Service msdepsvc,wmsvc Status Name DisplayName ------ ---- ----------- Running msdepsvc Web Deployment Agent Service Running wmsvc Web Managemen

使用Powershell脚本化web部署作业,我在某些主机上收到此错误:

C:\> Get-Service msdepsvc,wmsvc
Status   Name               DisplayName
------   ----               -----------
Running  msdepsvc           Web Deployment Agent Service
Running  wmsvc              Web Management Service

C:\> (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\WebManagement\Server' -Name EnableRemoteManagement).EnableRemoteManagement
1

C:\> Add-PSSnapin WDeploySnapin3.0
C:\> $credential = New-Object System.Management.Automation.PSCredential ("some-domain\some-user", (ConvertTo-SecureString "password" -AsPlainText -Force))
C:\> New-WDPublishSettings -ComputerName localhost -Credentials $credential -AllowUntrusted -Site "Default Web Site" -SiteUrl "http://localhost" -AgentType WMSvc -FileName publish.xml

AllowUntrusted          : True
PublishUrl              : localhost
SiteName                : Default Web Site
SiteUrl                 : http://localhost
Username                : some-domain\some-user
Password                : password
MySqlDBConnectionString :
SqlDBConnectionString   :
AgentType               : WMSvc
UseNTLM                 : False
OtherAttributes         : {}

C:\> Restore-WDPackage "package.zip" -DestinationPublishSettings publish.xml
Restore-WDPackage : Could not connect to the remote computer ("localhost"). On the remote computer, make sure that Web
Deploy is installed and that the required process ("Web Management Service") is started.  Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.
At line:1 char:1
+ Restore-WDPackage "package.zip" -DestinationPublishSett ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Restore-WDPackage], DeploymentDetailedException
    + FullyQualifiedErrorId : ERROR_DESTINATION_NOT_REACHABLE,Microsoft.Web.Deployment.PowerShell.SyncPackage
Windows防火墙未运行,同一脚本在其他计算机上成功运行(包已成功部署,网站按预期运行)。如上所示,msdepsvc和wmsvc都在运行,wmsvc配置为允许远程连接。无法接受Restore WDPackage命令的同一台计算机确实从IIS管理控制台接受远程管理连接(在运行
Set ItemProperty-Path'HKLM:\SOFTWARE\Microsoft\WebManagement\Server'-Name enablemotemanagement-Value 1
并重新启动服务后)。这本书没有任何线索,也不是很完整。其他WinRM命令工作正常(我们使用脚本创建目标网站)


还有什么可能会导致此错误?

增加日志记录可能会有所帮助,但如果它没有到达服务器,则可能不会增加任何价值。不过值得一试——直接使用WebDeploy试试,是否也会出现同样的错误?当代理未在机箱中运行,或者机器被IP而不是主机引用时,我看到了这个错误。尝试使用computerName而不是localhost。