Visual-studio – How to use MsDeploy to deploy a sub-application within a website

deploymentiis-7msdeployvisual studiowebdeploy

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?

Best Answer

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"
Related Topic