Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass the sitename in ProjectName.deploy.cmd

I am trying to run the ProjectName.deply.cmd that is generated by MSBuild when the paramter /p:DeployOnBuild=True is passed. One of the argument "ComputerName" is to be passed as https://WebServer01:8172/MSDeploy.axd?SiteName=MySiteName. My command line would be

ProjectName.deploy.cmd /Y /M:https://WebServer01:8172/MSDeploy.axd?Site=MySiteName 
                       -AllowUntrusted /U:DeployUserName /P:Password /A:Basic

It returns

Error: Unrecognized argument 'MySiteName'. All arguments must begin with "-".

the actual command that is executed is

"C:\Program Files\IIS\Microsoft Web Deploy V3\\msdeploy.exe" 
    -source:package='Y:\ProjectName.zip'
    -dest:auto,computerName='https://WebServer01:8172/MSDeploy.axd?Site',userName='DeployUserName',password='Password',authtype='Basic',includeAcls='False'
    -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension 
    -disableLink:CertificateExtension 
    -setParamFile:"Y:\ProjectName.SetParameters.xml"
    MySiteName
    -AllowUntrusted

Notice that the argument to /M https://WebServer01:8172/MSDeploy.axd?Site=MySiteName is split into two arguments and thus creating computerName='https://WebServer01:8172/MSDeploy.axd?Site' and and extra argument MySiteName.

I have gone through Running a deployment package with quoted parameters fails in Visual Studio 2010 Service Pack 1 but that takes care of only ArgMsDeployAdditionalFlags and not the arguments e.g. /M:ComputerName.

When the SiteName is not passed, I can do the deployment fine with an user that had admin rights on the server but when a standard IIS user DeployUserName is used I get 401

ProjectName.deploy.cmd /Y /M:https://WebServer01:8172/MSDeploy.axd
                       -AllowUntrusted /U:DeployUserName /P:Password /A:Basic

The server returns 401

Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the remote computer ("WebServer01") 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.

The permissions for that user are fine as the publish from VS2012 with MSDeploy profile using that user works just fine. I can also build msdeploy.exe command and that also runs fine. I have to use the ProjectName.deploy.cmd as it is being produced as part of Team Build from TFS2010.

like image 470
amit_g Avatar asked Oct 04 '12 07:10

amit_g


1 Answers

Have you tried quoting the argument?

ProjectName.deploy.cmd /Y "/M:https://WebServer01:8172/MSDeploy.axd?Site=MySiteName" 
                   -AllowUntrusted /U:DeployUserName /P:Password /A:Basic
like image 172
Richard Szalay Avatar answered Sep 28 '22 18:09

Richard Szalay