还原-WDPackage在另一个网站名称下

时间:2015-05-27 01:37:00

标签: powershell iis visual-studio-2013 deployment restore

我正在使用此脚本来部署由VS2013生成的Web包

function SyncPackage([Parameter(Mandatory=$true)][ValidateSet('DEV','TST','PRD', ignorecase=$False)][string]$env)
{

$redisHost=""
$redisAccessKey=""
$parameters = @{"Environment"=$env}
set-location "FILESYSTEM::d:\packages"
$srcServer = ("Web" + $env + "02.server")
$desterver = ("Web" + $env + "01.server")
New-WDPublishSettings -ComputerName $srcServer -AgentType MSDepSvc -FileName server01.publishsettings
New-WDPublishSettings -ComputerName $desterver -AgentType MSDepSvc -FileName server02.publishsettings

Restore-WDPackage .\(app)\server.Web.(App).DeviceService.zip -DestinationPublishSettings server01.publishsettings -Parameters $parameters

Read-host "Press <Enter> To Sync or Ctrl+C to cancel:>"
Sync-WDServer -SourcePublishSettings server01.publishsettings -DestinationPublishSettings server02.publishsettings
}
cls
SyncPackage -env TST

我的问题是(app)在IIS服务器上有另一个名称。无论如何在另一个网站名称下运行还原?

编辑:作为一种解决方法,我可以使用VS2013上的发布功能,并在Connection&gt;中使用IIS中的网站名称。发布向导的站点名称字段。

1 个答案:

答案 0 :(得分:1)

您是否可以尝试添加密钥&#34; IIS Web应用程序名称&#34;你的参数?

$site = "myapp.name"
Restore-WDPackage $package -DestinationPublishSettings $publishSettingsFile -Parameters @{ "IIS Web Application Name"="$site" }