使用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 EnableRemoteManagement -Value 1
并重新启动服务之后)。 MS help link不包含任何线索,the documentation for WDeploySnapin3.0并不完整。其他WinRM命令工作正常(我们使用this脚本创建目标网站)。
还有什么可能导致错误?