2

I'm trying to setup automatic deployment using msbuild.
I succeeded having a msdeploy sync call to successfully publish a zip package created with msbuild.
However when I try to perform a msdeploy delete call prior to the sync operation it fails with

ERROR_USER_NOT_AUTHORIZED_FOR_DEPLOYMENTPROVIDER

Is there any permissions or additional IIS delegation rules that should be set compared to the one used for the sync call ?

The msdeploy -verb:sync works correctly:

  Total changes: 676 (672 added, 0 deleted, 4 updated, 0 parameters changed, 55787329 bytes copied)
  Syncing done.

Howerver the msdeploy -verb:delete fails:

  Info: Using ID '138cbadf-3449-4574-8e3f-0a3bd13fe751' for connections to the remote server.
EXEC : error Code: ERROR_USER_NOT_AUTHORIZED_FOR_DEPLOYMENTPROVIDER [c:\PATH\Deploy.proj]
  More Information: Could not complete an operation with the specified provider ("auto") when connecting using the Web Management Service. This can o
  ccur if the server administrator has not authorized the user for this operation. auto http://go.microsoft.com/fwlink/?LinkId=178034
    Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_AUTHORIZED_FOR_DEPLOYMENTPROVIDER.

As you can see I'm using a msbuild proj file to to this. The msdeploy calls are performed with the <Exec> rule :

<Target Name="Publish" >
        <Message Importance="High" Text="Deleting from $(PublishServer) ..." />
        <!-- THIS FAILS: -->
        <Exec
          WorkingDirectory="$(MsDeployBinaryFolder)\"
          Command="&quot;$(MsDeployBinary)&quot; -verb:delete -dest:auto,computerName=&quot;https://$(PublishServer):8172/msdeploy.axd?Site=$(IisAppHostName)&quot;,authType=Basic,userName=$(UserName),password='$(Password)' -allowUntrusted -disableLink:ContentExtension -disableLink:AppPoolExtension"
        />
        <Message Importance="High" Text="Deletion done." />


        <Message Importance="High" Text="Syncing to $(PublishServer) ..." />
        <!-- THIS WORKS: -->
        <Exec
          WorkingDirectory="$(MsDeployBinaryFolder)\"
          Command="&quot;$(MsDeployBinary)&quot; -verb:sync -source:package=&quot;$(ArchiveDir)\$(SiteName)\$(SiteName).zip&quot; -dest:auto,computerName=&quot;https://$(PublishServer):8172/msdeploy.axd?Site=$(IisAppHostName)&quot;,authType=Basic,userName=$(UserName),password='$(Password)' -allowUntrusted -setParam:&quot;IIS Web Application Name&quot;=&quot;$(IisAppHostName)/$(IisSiteName)&quot;"
        />
        <Message Importance="High" Text="Syncing done." />
  </Target>

Any idea why sync can add and alter files while delete fails ?

1 Answer 1

1

Ok, got it working using the -dest:issApp instead of the -dest:auto provider.
Curiously enough, I can not use the -dest:iisApp provider when syncing from a source package without getting an event error:

Microsoft.Web.Deployment.DeploymentException: Source (sitemanifest) and destination (iisApp) are not compatible for the given operation.

So I use the -dest:auto for syncing and the -dest:iisApp for deleting.

<Exec
          WorkingDirectory="$(MsDeployBinaryFolder)\"
          Command="&quot;$(MsDeployBinary)&quot; -verb:delete -dest:iisApp=&quot;$(IisAppHostName)/$(IisSiteName)&quot;,computerName=&quot;https://$(PublishServer):8172/msdeploy.axd?Site=$(IisAppHostName)&quot;,authType=Basic,userName=$(UserName),password='$(Password)' -allowUntrusted -disableLink:ContentExtension -disableLink:AppPoolExtension"
        />

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .