How to use MsDeploy to deploy a sub-application within a website
Asked Answered
D

2

9

I have a sub application underneath an IIS website, and I can deploy it using the publish wizard in Visual Studio no problem.

However, I'm automating our deployment from our build server so I prefer to use msdeploy.exe directly.

I can deploy the main website, but trying to deploy the sub application refuses to work.

This works (www.mymainwebsite.co.uk being the IIS website):

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

This doesn't (SubApplication being the application path):

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

The error is:

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.

As I said, this works from the Visual Studio publish wizard, setting the Site/application property to www.mymainwebsite.co.uk/SubApplication, so I know it's not a permissions issue on the server.

Am I missing something in the msdeploy parameters?

Deanery answered 6/9, 2012 at 13:48 Comment(0)
J
10

I use the following on the command line to set the web application:

-setParam:name="IIS Web Application Name",value="www.mymainwebsite.co.uk/SubApplication"
Jilleen answered 10/9, 2012 at 12:52 Comment(4)
I am using 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'Topeka
It gives following Error message... Error: Source does not support parameter called 'IIS Web Application Name'. Must be one of (). Error count: 1.Topeka
Without set param ------c:\Program Files\IIS\Microsoft Web Deploy V3>msdeploy.exe -verb:sync -source:co ntentPath='E:\temp' -dest:contentPath='http://{IP}/testMsDeployOnIIS',C omputerName="https://{IP}/msdeploy.axd?site=Default%20Web%20Site",U serName='MyUser',Password='MyPasseord',AuthType='Basic' -enableRu le:DoNotDeleteRule -whatif -allowUntrustedTopeka
it gives following message.... Info: Using ID '8cce9292-0de0-49de-a192-d7d5fc0bcbfa' for connections to the rem ote server. Info: Adding MSDeploy.contentPath (MSDeploy.contentPath). Info: Adding virtual path (http://103.15.43.10/testMsDeployOnIIS) Error Code: ERROR_SITE_DOES_NOT_EXIST More Information: Site 'http:' does not exist. Learn more at: http://go.microso ft.com/fwlink/?LinkId=221672#ERROR_SITE_DOES_NOT_EXIST. Error count: 1.Topeka
R
1

In order to do a web deployment to sub-application of a main site, go to TFS, Deploy IIS App step, update the Override parameters to something like this

name="IIS Web Application Name",value="MainSite/SubApplication"

It should do the trick!!

Reglet answered 8/6, 2018 at 21:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.