我正在尝试使用msbuild设置自动部署。
我成功地通过msdeploy同步调用来成功发布使用msbuild创build的zip包。
但是,当我尝试在同步操作之前执行msdeploy删除调用时,它将失败
ERROR_USER_NOT_AUTHORIZED_FOR_DEPLOYMENTPROVIDER
是否有任何权限或额外的IIS委托规则应该设置与用于同步呼叫的规则相比?
msdeploy -verb:sync正常工作:
Total changes: 676 (672 added, 0 deleted, 4 updated, 0 parameters changed, 55787329 bytes copied) Syncing done.
保证msdeploy -verb:delete失败:
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.
正如你可以看到我正在使用一个msbuild proj文件来这个。 msdeploy调用是使用<Exec>规则执行的:
<Target Name="Publish" > <Message Importance="High" Text="Deleting from $(PublishServer) ..." /> <!-- THIS FAILS: --> <Exec WorkingDirectory="$(MsDeployBinaryFolder)\" Command=""$(MsDeployBinary)" -verb:delete -dest:auto,computerName="https://$(PublishServer):8172/msdeploy.axd?Site=$(IisAppHostName)",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=""$(MsDeployBinary)" -verb:sync -source:package="$(ArchiveDir)\$(SiteName)\$(SiteName).zip" -dest:auto,computerName="https://$(PublishServer):8172/msdeploy.axd?Site=$(IisAppHostName)",authType=Basic,userName=$(UserName),password='$(Password)' -allowUntrusted -setParam:"IIS Web Application Name"="$(IisAppHostName)/$(IisSiteName)"" /> <Message Importance="High" Text="Syncing done." /> </Target>
任何想法为什么同步可以添加和更改文件,而删除失败?
好的,使用-dest:issApp而不是-dest:auto提供程序来工作。
奇怪的是,我不能使用-dest:iisApp提供程序从一个源包进行同步,而不会收到事件错误:
Microsoft.Web.Deployment.DeploymentException:源(sitemanifest)和目标(iisApp)对给定的操作不兼容。
所以我使用-dest:auto进行同步,使用-dest:iisApp进行删除。
<Exec WorkingDirectory="$(MsDeployBinaryFolder)\" Command=""$(MsDeployBinary)" -verb:delete -dest:iisApp="$(IisAppHostName)/$(IisSiteName)",computerName="https://$(PublishServer):8172/msdeploy.axd?Site=$(IisAppHostName)",authType=Basic,userName=$(UserName),password='$(Password)' -allowUntrusted -disableLink:ContentExtension -disableLink:AppPoolExtension" />