如何使用MsDeploy在网站内部署子应用程序

9
我有一个位于IIS网站下的子应用程序,使用Visual Studio中的发布向导可以轻松部署。但是,我正在从我们的构建服务器自动化部署,因此我更喜欢直接使用msdeploy.exe。
我可以部署主网站,但尝试部署子应用程序时无法正常工作。
这个命令行(www.mymainwebsite.co.uk 是 IIS 网站)可以正常运行:
msdeploy.exe -source:package='www.mymainwebsite.co.uk\obj\Test\Package\www.mymainwebsite.co.uk.zip' -dest:auto,computerName='https://testweb1:8172/MsDeploy.axd?site=www.mymainwebsite.co.uk',userName='xxx',password='xxx',authtype='Basic',includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"www.mymainwebsite.co.uk\obj\Test\Package\www.mymainwebsite.co.uk.SetParameters.xml" -allowUntrustedInfo
而这个命令行无法正常工作(SubApplication 是应用程序路径):
msdeploy.exe -source:package='SubApplication\obj\Test\Package\SubApplication.zip' -dest:auto,computerName='https://testweb1:8172/MsDeploy.axd?site=www.mymainwebsite.co.uk/SubApplication',userName='xxx',password='xxx',authtype='Basic',includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"SubApplication\obj\Test\Package\SubApplication.SetParameters.xml" -allowUntrustedInfo
错误信息如下:
Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the remote computer ("testweb1") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.
Error: The remote server returned an error: (401) Unauthorized.

正如我之前所说的,这个在从Visual Studio发布向导中运行,将站点/应用属性设置为www.mymainwebsite.co.uk/SubApplication是有效的,因此我知道这不是服务器上的权限问题。
我在msdeploy参数中是否漏掉了什么?
2个回答

10

我在命令行中使用以下命令来设置Web应用程序:

-setParam:name="IIS Web Application Name",value="www.mymainwebsite.co.uk/SubApplication"

我正在使用 msdeploy.exe -verb:sync -source:contentPath='E:\temp' -dest:contentPath='http://{IP}/testMsDeployOnIIS',ComputerName="https://{IP}:8172/msdeploy.axd?site=Default%20Web%20Site",UserName='MyUser',Password='MyPassword',AuthType='Basic' -enableRule:DoNotDeleteRule -whatif -allowUntrusted -setParam:name='IIS Web Application Name',value='http://{IP}/testMsDeployOnIIS' - Khalid Farhan
3
出现如下错误信息:错误:源不支持名为'IIS Web Application Name'的参数。必须是以下之一:()。错误计数:1。 - Khalid Farhan
没有设置参数------c:\Program Files\IIS\Microsoft Web Deploy V3>msdeploy.exe -verb:sync -source:contentPath='E:\temp' -dest:contentPath='http://{IP}/testMsDeployOnIIS',ComputerName="https://{IP}/msdeploy.axd?site=Default%20Web%20Site",UserName='MyUser',Password='MyPasseord',AuthType='Basic' -enableRule:DoNotDeleteRule -whatif -allowUntrusted - Khalid Farhan
它给出以下信息.... 信息: 使用ID“8cce9292-0de0-49de-a192-d7d5fc0bcbfa”连接到远程服务器。 信息: 添加MSDeploy.contentPath(MSDeploy.contentPath)。 信息: 添加虚拟路径(http://103.15.43.10/testMsDeployOnIIS) 错误代码:ERROR_SITE_DOES_NOT_EXIST 更多信息:网站'http:'不存在。 了解更多信息:http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SITE_DOES_NOT_EXIST。 错误计数:1。 - Khalid Farhan

1
为了将Web部署到主站点的子应用程序中,请转到TFS,Deploy IIS App步骤,更新Override参数,例如:
name="IIS Web Application Name",value="MainSite/SubApplication"
这样就可以完成了!

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接