Webdeploy permission issue
I have found the solution for the problem. The third package was trying to create a new application on the server because of a different application name than the other two packages. I have added a new setParameters.xml file that has entry for the application name which will overwrite the default application name with the one the previous two packages were deploying to. I pass this setParameters.xml file as a parameter to the Webdeploy command.
&'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe' -verb:sync -source:package='D:\temp\Project_XYZ.zip' -setParamFile:setParameters.xml -dest="auto,computerName='https://localhost:8172/msdeploy.axd?site=siteName',username='deployUser',password='changeMe',authType=basic,includeAcls='False'" -skip:objectName=createApp -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -allowUntrusted -whatif
setParameters.xml
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="siteName" />
</parameters>
Unless the user is an administrator, you need to grant them access to deploy to the website. You can do so by right clicking on the website in IIS Manager and select Deploy :: Configure Web Deploy Publishing
. Just select the user and click OK (you can delete the publish settings file it generates on the desktop)