Skip to content

Remote deployment having "nested" site name fails #49

Open
@tbehunin

Description

[The real root of this issue appears to be an MSDeploy bug, but there appears to be a work-around for PackageWeb, as outlined below.]

If remotely deploying (i.e. not localhost) via PackageWeb to an IIS site that is nested within one/more sites (i.e. "MySite\MyNestedSite"), PackageWeb will generate the following MSDeploy string:

"C:\Program Files\IIS\Microsoft Web Deploy V2\msdeploy.exe" -verb:sync -source:archiveDir="[archive dir here]" -dest:auto,includeAcls='False',ComputerName='https://MyServer:8172/MSDeploy.axd?site=MySite\MyNestedSite',Username=myusername,Password=mypassword,AuthType='BASIC' -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"[archive dir here]\SetParameters.xml"  -skip:objectName=dirPath,absolutePath="_Deploy_" -skip:objectName=filePath,absolutePath=web\..*\.config -skip:objectName=dirPath,absolutePath=_Package -skip:objectName=filePath,absolutePath=.*\.wpp\.targets$ -allowUntrusted -enableRule:DoNotDelete

Running this will result in the following error:

Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the destination computer ("MyServer") using the Web Management Service, but could not uthorize. 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.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.

The error msg appears to be a red herring though. You will notice that the ComputerName value tacks on the site in the querystring:

https://MyServer:8172/MSDeploy.axd?site=MySite\MyNestedSite

Because the site name is still being written to the SetParameters.xml file, PackageWeb doesn't need to tack the site in the querystring. In fact, if you execute the same command above and only change the ComputerName key/value to:

ComputerName='https://MyServer:8172/MSDeploy.axd'

the deployment succeeds! So, the fix to this issue would simply be tweaking a line in the BuildMSDeployCommand() method in the Publish-Interactive.ps1 file to remove the "?site={1}", like so:

$compNameCommandFrag = ",ComputerName='{0}'" -f $compNameFixedUp

As stated earlier, the issue appears to be an MSDeploy issue, not accepting/parsing nested site names in the querystring for whatever reason. But that limitation can be alleviated if you use the SetParameters.xml file to specify the site name instead - and NOT specify the site as a querystring parameter in the ComputerName variable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions